Class: PBatcher::ProcHandler

Inherits:
Handler
  • Object
show all
Defined in:
lib/pbatcher/proc_handler.rb

Direct Known Subclasses

Namer, Processor, Validator

Instance Attribute Summary collapse

Attributes inherited from Handler

#generator

Instance Method Summary collapse

Constructor Details

#initialize(generator, method = nil, &block) ⇒ ProcHandler

Returns a new instance of ProcHandler.

Raises:

  • (ArgumentError)


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

#methodObject (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