module BOAST::VarFunctors
Public Instance Methods
var_functorize(klass)
click to toggle source
Creates a functor to create a Variable
of type klass @param [DataType] klass DataType
to turn into a functor and add it to the VarFunctors
module. @private @!macro [attach] var_functorize
@!method $1(name, *args, &block) Creates a new Variable of type $1. @param [#to_s] name name of the Variable @param [Object] args parameters to use when creating a Variable @param [Proc] block block of code will be forwarded
# File lib/BOAST/Language/Functors.rb, line 53 def var_functorize(klass) name = klass.name.split('::').last s = <<EOF def #{name}(*args,&block) Variable::new(args[0],#{name},*args[1..-1], &block) end EOF class_eval s end