Class: Processor
- Inherits:
-
Object
- Object
- Processor
- Defined in:
- lib/mylookup/processor.rb
Overview
class containing the functionalities of handling the whole show
Instance Attribute Summary collapse
-
#unmatched ⇒ Object
readonly
Returns the value of attribute unmatched.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Processor
constructor
A new instance of Processor.
-
#process ⇒ Object
Executes reading, lookup and writing the unmatched.
-
#process_without_writing ⇒ Object
Processes [Reading and Lookup] without writing the unmatched.
Constructor Details
#initialize(opts) ⇒ Processor
Returns a new instance of Processor.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mylookup/processor.rb', line 9 def initialize(opts) @l_db, @l_tbl, @l_on = opts[:left], opts[:leftsheet], opts[:lefton] @r_db, @r_tbl, @r_on = opts[:right], opts[:rightsheet], opts[:righton] @verbose = opts[:verbose] @l_src, @r_src = opts[:l_src], opts[:r_src] @l_reader, @r_reader = nil, nil @l_data, @r_data, @matched, @unmatched = nil, nil, nil, nil if @l_src == :excel @l_reader = FileReader::Excel.new(@l_db, @l_tbl, @l_on) else @l_reader = FileReader::MongoDB.new(@l_on, @l_tbl, db_name: @l_db) end if @r_src == :excel @r_reader = FileReader::Excel.new(@r_db, @r_tbl, @r_on) else @r_reader = FileReader::MongoDB.new(@r_on, @r_tbl, db_name: @r_db) end end |
Instance Attribute Details
#unmatched ⇒ Object (readonly)
Returns the value of attribute unmatched.
7 8 9 |
# File 'lib/mylookup/processor.rb', line 7 def unmatched @unmatched end |
Instance Method Details
#process ⇒ Object
Executes reading, lookup and writing the unmatched
29 30 31 32 33 34 |
# File 'lib/mylookup/processor.rb', line 29 def process puts "Processing initiating..." read_data mylookup write_unmatched unless @unmatched.empty? end |
#process_without_writing ⇒ Object
Processes [Reading and Lookup] without writing the unmatched
37 38 39 40 41 |
# File 'lib/mylookup/processor.rb', line 37 def process_without_writing puts "Processing initiating..." read_data mylookup end |