Class: Hakoy::RowNormalizer

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

Defined Under Namespace

Modules: GenerateUniqueId

Constant Summary collapse

MissingRequiredKeysError =
Class.new(StandardError)

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ RowNormalizer

Returns a new instance of RowNormalizer.



11
12
13
14
# File 'lib/hakoy/row_normalizer.rb', line 11

def initialize(opts)
  @uid_key = opts.fetch(:uid_key)
  @required_keys = opts.fetch(:required_keys).dup.freeze
end

Instance Method Details

#normalize(hash) ⇒ Object Also known as: call



16
17
18
19
# File 'lib/hakoy/row_normalizer.rb', line 16

def normalize(hash)
  assert_has_required_keys!(hash, @required_keys)
  build_normalized_hash(hash)
end