Module: Ribbon::CoreExtensions::BasicObject
- Defined in:
- lib/ribbon/core_extensions/basic_object.rb
Overview
Some useful methods.
Instance Method Summary collapse
-
#__yield_or_eval__ {|object| ... } ⇒ ::Object?
Evaluates the block using
instance_eval
if it takes no arguments; yields this object to it otherwise.
Instance Method Details
#__yield_or_eval__ {|object| ... } ⇒ ::Object?
Evaluates the block using instance_eval
if it takes no arguments; yields this object to it otherwise.
15 16 17 18 19 20 21 |
# File 'lib/ribbon/core_extensions/basic_object.rb', line 15 def __yield_or_eval__(&block) if block.arity.zero? instance_eval &block else block.call self end unless block.nil? end |