Class: UniversalID::Prepacker

Inherits:
Object
  • Object
show all
Defined in:
lib/universalid/prepacker.rb

Defined Under Namespace

Classes: CircularReferenceError

Class Method Summary collapse

Class Method Details

.prepack(object, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/universalid/prepacker.rb', line 16

def prepack(object, options = {})
  options = UniversalID::PrepackOptions.new(options) unless options.is_a?(UniversalID::PrepackOptions)
  object.instance_variable_set(:@_uid_prepack_options, options) unless object.frozen?

  return object unless object.respond_to?(:prepack)

  object.prepack options
end