Class: Hakoy::RowNormalizer
- Inherits:
-
Object
- Object
- Hakoy::RowNormalizer
- Defined in:
- lib/hakoy/row_normalizer.rb
Defined Under Namespace
Modules: GenerateUniqueId
Constant Summary collapse
- MissingRequiredKeysError =
Class.new(StandardError)
Instance Method Summary collapse
-
#initialize(opts) ⇒ RowNormalizer
constructor
A new instance of RowNormalizer.
- #normalize(hash) ⇒ Object (also: #call)
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 |