module BOAST::Functors
Public Instance Methods
functorize(klass)
click to toggle source
Creates a wrapper for klass new method @param [Class] klass class to turn into a functor. @private @!macro [attach] functorize
@!method $1 Creates a new $1 object, arguments are passed to the *new* method of $1. (see {$1#initialize}).
# File lib/BOAST/Language/Functors.rb, line 28 def functorize(klass) name = klass.name.split('::').last s = <<EOF def #{name}(*args,&block) #{name}::new(*args,&block) end EOF class_eval s end