Class: Muack::Block
- Inherits:
-
Struct
- Object
- Struct
- Muack::Block
- Defined in:
- lib/muack/block.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#context ⇒ Object
Returns the value of attribute context.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(block, context = nil) ⇒ Block
constructor
A new instance of Block.
Constructor Details
#initialize(block, context = nil) ⇒ Block
Returns a new instance of Block.
4 5 6 |
# File 'lib/muack/block.rb', line 4 def initialize block, context=nil super end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block
3 4 5 |
# File 'lib/muack/block.rb', line 3 def block @block end |
#context ⇒ Object
Returns the value of attribute context
3 4 5 |
# File 'lib/muack/block.rb', line 3 def context @context end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/muack/block.rb', line 8 def call(...) if context context.instance_exec(...) else block.call(...) end end |