Class: TezosClient::Tools::ConvertToHash::Timestamp
- Defined in:
- lib/tezos_client/tools/convert_to_hash/timestamp.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from TezosClient::Tools::ConvertToHash::Base
Instance Method Details
#decode ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/tezos_client/tools/convert_to_hash/timestamp.rb', line 7 def decode if data.key? :int Time.zone.at(data[:int].to_i) elsif data.key? :string return Time.zone.at(data[:string].to_i) if data[:string].match?(/\A\d+\z/) Time.zone.parse(data[:string]) else raise "Can not convert timestamp: #{data}" end end |