Documentation ¶
Index ¶
- type BindContext
- func (bc BindContext) Arg(idx int) (*mruby.MrbValue, bool)
- func (bc BindContext) BindFloat(attr string, target *float64)
- func (bc BindContext) BindInt(attr string, target *int)
- func (bc BindContext) BindMapAttr(attr string, m map[string]interface{}, key string)
- func (bc BindContext) BindString(attr string, str *string)
- func (bc BindContext) BindStringFn(attr string, f func(string))
- func (bc BindContext) Block(attr string, f func(BindContext))
- func (bc BindContext) BlockWith(attr string, args mruby.ArgSpec, f func(BindContext))
- func (bc BindContext) BlockWithArg(attr string, f func(BindContext))
- func (bc BindContext) StringArg(idx int) string
- type Interpreter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindContext ¶
type BindContext struct {
// contains filtered or unexported fields
}
BindContext binds ruby methods in the config to variables in Go.
func (BindContext) Arg ¶
func (bc BindContext) Arg(idx int) (*mruby.MrbValue, bool)
func (BindContext) BindFloat ¶
func (bc BindContext) BindFloat(attr string, target *float64)
BindFloat binds a Ruby method named `attr` to a target float64.
func (BindContext) BindInt ¶
func (bc BindContext) BindInt(attr string, target *int)
BindInt binds a Ruby method named `attr` to a target integer.
func (BindContext) BindMapAttr ¶
func ( bc BindContext, ) BindMapAttr( attr string, m map[string]interface{}, key string, )
BindMapAttr binds a Ruby method named `attr` to the key, `key`, in the provided map.
func (BindContext) BindString ¶
func (bc BindContext) BindString(attr string, str *string)
BindString binds a string value in the config to a go string var.
func (BindContext) BindStringFn ¶
func (bc BindContext) BindStringFn(attr string, f func(string))
func (BindContext) Block ¶
func (bc BindContext) Block(attr string, f func(BindContext))
Block binds a config block to a Go function. The function will be called and passed a new BindContext with which to build a new anonymous class, that will in turn be used as the context for the Ruby config block.
func (BindContext) BlockWith ¶
func ( bc BindContext, ) BlockWith( attr string, args mruby.ArgSpec, f func(BindContext), )
BlockWith binds an attribute, `attr`, that takes `args` to a function that accepts and runs a block. Before the block is executed, `f` will be called and passed the BindContext that will be used, allowing it to configure any DSL options that should be available.
func (BindContext) BlockWithArg ¶
func (bc BindContext) BlockWithArg(attr string, f func(BindContext))
BlockWithArg is a convenience method that calls BlockWith expecting exactly one argument from Ruby.
func (BindContext) StringArg ¶
func (bc BindContext) StringArg(idx int) string
type Interpreter ¶
type Interpreter func(io.ReadCloser) error
func NewInterpreter ¶
func NewInterpreter(fn func(bc BindContext)) (Interpreter, error)