Module: T::Props::Serializable::ClassMethods
- Defined in:
- lib/types/props/serializable.rb
Overview
NB: This must stay in the same file where T::Props::Serializable is defined due to T::Props::Decorator#apply_plugin; see git.corp.stripe.com/stripe-internal/pay-server/blob/fc7f15593b49875f2d0499ffecfd19798bac05b3/chalk/odm/lib/chalk-odm/document_decorator.rb#L716-L717
Class Method Summary collapse
-
.from_hash(hash, strict) ⇒ Serializable
Allocate a new instance and call #deserialize to load a new object from a hash.
Instance Method Summary collapse
-
#from_hash(hash, strict = false) ⇒ Serializable
Allocate a new instance and call #deserialize to load a new object from a hash.
-
#from_hash!(hash) ⇒ Serializable
Equivalent to ClassMethods.from_hash with ‘strict` set to true.
- #prop_by_serialized_forms ⇒ Object
Class Method Details
.from_hash(hash, strict) ⇒ Serializable
Allocate a new instance and call T::Props::Serializable#deserialize to load a new object from a hash.
376 377 378 |
# File 'lib/types/props/serializable.rb', line 376 def from_hash(hash, strict=false) self.decorator.from_hash(hash, strict) end |
Instance Method Details
#from_hash(hash, strict = false) ⇒ Serializable
Allocate a new instance and call T::Props::Serializable#deserialize to load a new object from a hash.
376 377 378 |
# File 'lib/types/props/serializable.rb', line 376 def from_hash(hash, strict=false) self.decorator.from_hash(hash, strict) end |
#from_hash!(hash) ⇒ Serializable
Equivalent to from_hash with ‘strict` set to true.
382 383 384 |
# File 'lib/types/props/serializable.rb', line 382 def from_hash!(hash) self.decorator.from_hash(hash, true) end |
#prop_by_serialized_forms ⇒ Object
369 |
# File 'lib/types/props/serializable.rb', line 369 def prop_by_serialized_forms; @prop_by_serialized_forms ||= {}; end |