Class: Primitives::BlockBreaker
- Inherits:
-
BlankSlate
- Object
- BlankSlate
- Primitives::BlockBreaker
- Includes:
- Inclusion
- Defined in:
- lib/extensions/primitives.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(&block) ⇒ BlockBreaker
constructor
A new instance of BlockBreaker.
- #method_missing(name, *args, &block) ⇒ Object
Methods included from Inclusion
Constructor Details
#initialize(&block) ⇒ BlockBreaker
Returns a new instance of BlockBreaker.
30 31 32 33 34 35 36 |
# File 'lib/extensions/primitives.rb', line 30 def initialize(&block) if block_given? @handler = block else raise NoBlockGiven, "Must be a block to break!" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
37 38 39 |
# File 'lib/extensions/primitives.rb', line 37 def method_missing(name, *args, &block) @handler.call(name, args, block) end |