Class: Hakoy::Proxy
- Inherits:
-
Object
- Object
- Hakoy::Proxy
- Defined in:
- lib/hakoy.rb
Constant Summary collapse
- DEFAULT_OUTPUT_FORMAT =
'csv'
- DEFAULT_UID_KEY =
'uid'
Instance Method Summary collapse
-
#initialize(conf) ⇒ Proxy
constructor
A new instance of Proxy.
- #store(file) ⇒ Object
Constructor Details
#initialize(conf) ⇒ Proxy
Returns a new instance of Proxy.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/hakoy.rb', line 22 def initialize(conf) @timestamp_key = conf.fetch(:timestamp_key) @db_dir = conf.fetch(:db_dir) @output_format = conf.fetch(:output_format) { DEFAULT_OUTPUT_FORMAT } @uid_key = conf.fetch(:uid_key) { DEFAULT_UID_KEY } @file_iterator = conf.fetch(:file_iterator) { FileIterator } @append_strategy = conf.fetch(:append_strategy) { AppendStrategy.new } @required_keys_mapping = conf.fetch(:required_keys_mapping) @timestamp_path = TimestampPath.new @row_normalizer = RowNormalizer.new( required_keys: @required_keys_mapping.values, uid_key: @uid_key ) end |
Instance Method Details
#store(file) ⇒ Object
36 37 38 39 |
# File 'lib/hakoy.rb', line 36 def store(file) @file_iterator.(file) { |row_hash| store_row(row_hash) } finalize_store! end |