Class: PBatcher::Generator
- Inherits:
-
Object
- Object
- PBatcher::Generator
- Defined in:
- lib/pbatcher/generator.rb
Instance Attribute Summary collapse
-
#iterator ⇒ Object
readonly
Returns the value of attribute iterator.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#namer ⇒ Object
readonly
Returns the value of attribute namer.
-
#processor ⇒ Object
readonly
Returns the value of attribute processor.
-
#validator ⇒ Object
readonly
Returns the value of attribute validator.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Generator
constructor
A new instance of Generator.
- #iteration(data) ⇒ Object
- #logging(logger) ⇒ Object
- #naming(l = nil, &block) ⇒ Object
- #processing(l = nil, &block) ⇒ Object
- #run ⇒ Object
- #validation(l = nil, &block) ⇒ Object
Constructor Details
#initialize ⇒ Generator
Returns a new instance of Generator.
12 13 14 |
# File 'lib/pbatcher/generator.rb', line 12 def initialize end |
Instance Attribute Details
#iterator ⇒ Object (readonly)
Returns the value of attribute iterator.
3 4 5 |
# File 'lib/pbatcher/generator.rb', line 3 def iterator @iterator end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/pbatcher/generator.rb', line 3 def logger @logger end |
#namer ⇒ Object (readonly)
Returns the value of attribute namer.
3 4 5 |
# File 'lib/pbatcher/generator.rb', line 3 def namer @namer end |
#processor ⇒ Object (readonly)
Returns the value of attribute processor.
3 4 5 |
# File 'lib/pbatcher/generator.rb', line 3 def processor @processor end |
#validator ⇒ Object (readonly)
Returns the value of attribute validator.
3 4 5 |
# File 'lib/pbatcher/generator.rb', line 3 def validator @validator end |
Class Method Details
.build(&block) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/pbatcher/generator.rb', line 5 def self.build(&block) obj = new obj.instance_eval(&block) if block_given? obj.run obj end |
Instance Method Details
#iteration(data) ⇒ Object
30 31 32 |
# File 'lib/pbatcher/generator.rb', line 30 def iteration(data) @iterator = Iterator.new self, data end |
#logging(logger) ⇒ Object
38 39 40 |
# File 'lib/pbatcher/generator.rb', line 38 def logging(logger) @logger = logger end |
#naming(l = nil, &block) ⇒ Object
22 23 24 |
# File 'lib/pbatcher/generator.rb', line 22 def naming(l = nil, &block) @namer = Namer.new self, l || block end |
#processing(l = nil, &block) ⇒ Object
34 35 36 |
# File 'lib/pbatcher/generator.rb', line 34 def processing(l = nil, &block) @processor = Processor.new self, l || block end |
#run ⇒ Object
16 17 18 19 20 |
# File 'lib/pbatcher/generator.rb', line 16 def run setup_default_handlers logger.info '------------------------------------' iterator.iterate { |item| processor.process item } end |