Class: Hakoy::TimestampNormalizer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#keyObject (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