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:



394
395
396
# File 'lib/types/props/serializable.rb', line 394

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:



400
401
402
# File 'lib/types/props/serializable.rb', line 400

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

#prop_by_serialized_formsObject



387
388
389
# File 'lib/types/props/serializable.rb', line 387

def prop_by_serialized_forms
  @prop_by_serialized_forms ||= {}
end