Skip to content

Commit

Permalink
Spell incantation options "mixin"
Browse files Browse the repository at this point in the history
To allow to compose, manipulate and read spell incantation options afte
the initial creation, two new types will be added for the spell
packages [1]:

- <I> `spell.Options` - A `interface` type as a generic representation
  for `spell.Incantation` options.
- <I> `spell.Mixin` - A `interface` type that allows to compose
  functions that process `spell.Options` of `spell.Incantation`s.
  - `Apply(Options) (Options, error)` - applies generic `spell.Options`
    to `spell.Incantation` options.

[1]: https://pkg.go.dev/github.com/svengreb/wand/pkg/spell

GH-25
  • Loading branch information
svengreb committed Nov 23, 2020
1 parent 95c22a0 commit e159a4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions pkg/spell/mixin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) 2019-present Sven Greb <[email protected]>
// This source code is licensed under the MIT license found in the LICENSE file.

package spell

// Options is a generic representation for spell incantation options.
type Options interface{}

// Mixin allows to compose functions that process Options of spell incantations.
type Mixin interface {
// Apply applies generic Options to spell incantation options.
Apply(Options) (Options, error)
}
2 changes: 1 addition & 1 deletion pkg/spell/spell.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Incantation interface {
// Kind returns the Kind of a spell.
Kind() Kind

// Options return the options of a spell.
// Options returns the options of a spell.
Options() interface{}
}

Expand Down

0 comments on commit e159a4d

Please sign in to comment.