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

Instance Method Summary collapse

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.

Returns:



373
374
375
# File 'lib/types/props/serializable.rb', line 373

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.

Returns:



379
380
381
# File 'lib/types/props/serializable.rb', line 379

def from_hash!(hash)
  self.decorator.from_hash(hash, true)
end

#prop_by_serialized_formsObject



366
367
368
# File 'lib/types/props/serializable.rb', line 366

def prop_by_serialized_forms
  @prop_by_serialized_forms ||= {}
end