Class: Prototok::Serializers::Time

Inherits:
Base
  • Object
show all
Defined in:
lib/prototok/serializers/time.rb

Constant Summary

Constants inherited from Base

Base::KEY_OPERATIONS

Instance Attribute Summary

Attributes inherited from Base

#object

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

apply_key_ops!, apply_op, attribute, attribute_storage, check_value, #initialize, key_ops

Constructor Details

This class inherits a constructor from Prototok::Serializers::Base

Class Method Details

.decode(value) ⇒ Object



10
11
12
# File 'lib/prototok/serializers/time.rb', line 10

def self.decode value
  ::Time.iso8601(value)
end

Instance Method Details

#encodeObject



6
7
8
# File 'lib/prototok/serializers/time.rb', line 6

def encode
  @object && @object.iso8601(Prototok.config[:time_encoding_precision])
end