Class: MethodMatching::ExtendableBlock
- Defined in:
- lib/method_matching/extendable_block.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
Instance Method Summary collapse
- #block_given? ⇒ Boolean
- #call(*args) ⇒ Object
-
#initialize(&definition) ⇒ ExtendableBlock
constructor
A new instance of ExtendableBlock.
Constructor Details
#initialize(&definition) ⇒ ExtendableBlock
Returns a new instance of ExtendableBlock.
5 6 7 |
# File 'lib/method_matching/extendable_block.rb', line 5 def initialize(&definition) @definition = definition end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
3 4 5 |
# File 'lib/method_matching/extendable_block.rb', line 3 def block @block end |
Instance Method Details
#block_given? ⇒ Boolean
13 14 15 |
# File 'lib/method_matching/extendable_block.rb', line 13 def block_given? !!@block end |
#call(*args) ⇒ Object
9 10 11 |
# File 'lib/method_matching/extendable_block.rb', line 9 def call(*args) instance_exec(*args, &@definition) end |