Methods
Public Instance methods
Translates a Proc into an OpenObject. By droping an OpenObject into the Proc, the resulting assignments incured as the procedure is evaluated produce the OpenObject. This technique is simlar to that of MethodProbe.
p = lambda { |x| x.word = "Hello" } o = p.to_openobject o.word #=> "Hello"
NOTE The Proc must have an arity of one —no more and no less.
[ show source ]
# File lib/more/facets/openobject.rb, line 255 def to_openobject raise ArgumentError, 'bad arity for converting Proc to openobject' if arity != 1 o = OpenObject.new self.call( o ) o end