Class: PBatcher::ProcHandler
- Defined in:
- lib/pbatcher/proc_handler.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Attributes inherited from Handler
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(generator, method = nil, &block) ⇒ ProcHandler
constructor
A new instance of ProcHandler.
Constructor Details
#initialize(generator, method = nil, &block) ⇒ ProcHandler
Returns a new instance of ProcHandler.
5 6 7 8 9 10 |
# File 'lib/pbatcher/proc_handler.rb', line 5 def initialize(generator, method = nil, &block) super(generator) method = method ? method : block raise ArgumentError, 'Namer is not a proc' unless method.is_a? Proc @method = method || block end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
3 4 5 |
# File 'lib/pbatcher/proc_handler.rb', line 3 def method @method end |
Instance Method Details
#call(*args) ⇒ Object
12 13 14 |
# File 'lib/pbatcher/proc_handler.rb', line 12 def call(*args) method.call(*args) end |