Class: Hakoy::TimestampNormalizer
- Inherits:
-
Object
- Object
- Hakoy::TimestampNormalizer
- Defined in:
- lib/hakoy/timestamp_normalizer.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #call(hash) ⇒ Object
-
#initialize(opts) ⇒ TimestampNormalizer
constructor
A new instance of TimestampNormalizer.
Constructor Details
#initialize(opts) ⇒ TimestampNormalizer
Returns a new instance of TimestampNormalizer.
5 6 7 |
# File 'lib/hakoy/timestamp_normalizer.rb', line 5 def initialize(opts) @key = opts.fetch(:key) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/hakoy/timestamp_normalizer.rb', line 3 def key @key end |
Instance Method Details
#call(hash) ⇒ Object
9 10 11 12 |
# File 'lib/hakoy/timestamp_normalizer.rb', line 9 def call(hash) hash[key] = Chronic.parse(hash[key]).to_s hash end |