Beahvior
Behavior class is used to encapsulates a behavior.
nil.behaving(:to_nil) do "1" end
TODO: This behavior library needs improvement. If we can
refine it enough and it proves solid, this would make a good candidate for core.
Methods
Public Instance methods
[ show source ]
# File lib/facets/behavior.rb, line 41 def define(behavior, &body) if body define_method(behavior, &body) else behavior.each do |behavior, body| if body define_method(behavior, &body) elsif body.nil? remove_method(behavior) else undef_method(behavior) end end end end