Class: Hakoy::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/hakoy.rb

Constant Summary collapse

DEFAULT_OUTPUT_FORMAT =
'csv'
DEFAULT_UID_KEY =
'id'

Instance Method Summary collapse

Constructor Details

#initialize(conf) ⇒ Proxy

Returns a new instance of Proxy.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/hakoy.rb', line 20

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 }
  required_keys   = conf.fetch(:required_keys)

  @timestamp_path = TimestampPath.new
  @row_normalizer = RowNormalizer.new(
    required_keys: required_keys, uid_key: @uid_key)
end

Instance Method Details

#store(file) ⇒ Object



32
33
34
35
36
# File 'lib/hakoy.rb', line 32

def store(file)
  FileIterator.(file) do |row_hash|
    store_row(row_hash)
  end
end