Class: AWS::Record::Attributes::SerializedAttr
- Inherits:
-
BaseAttr
- Object
- BaseAttr
- AWS::Record::Attributes::SerializedAttr
- Defined in:
- lib/dyna_model/aws/record/attributes/date_time_attr.rb,
lib/dyna_model/aws/record/attributes/serialized_attr.rb
Class Method Summary collapse
- .allow_set? ⇒ Boolean private
-
.serialize(obj, options = {}) ⇒ Object
OVERRIDE github.com/aws/aws-sdk-ruby/blob/master/lib/aws/record/attributes.rb#L372 Allow Time instead of just DateTime.
- .type_cast(raw_value, options = {}) ⇒ Object
Class Method Details
.allow_set? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/dyna_model/aws/record/attributes/serialized_attr.rb', line 26 def self.allow_set? false end |
.serialize(obj, options = {}) ⇒ Object
OVERRIDE github.com/aws/aws-sdk-ruby/blob/master/lib/aws/record/attributes.rb#L372 Allow Time instead of just DateTime
9 10 11 12 13 14 15 |
# File 'lib/dyna_model/aws/record/attributes/date_time_attr.rb', line 9 def self.serialize datetime, = {} unless datetime.is_a?(DateTime) || datetime.is_a?(Time) msg = "expected a DateTime value, got #{datetime.class}" raise ArgumentError, msg end datetime.strftime('%Y-%m-%dT%H:%M:%S%Z') end |
.type_cast(raw_value, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dyna_model/aws/record/attributes/serialized_attr.rb', line 6 def self.type_cast raw_value, = {} case raw_value when nil then nil when '' then nil when String # assume binary begin Marshal.load(raw_value) rescue raw_value end else # object to serialize raw_value end end |