Module: TrickSerial::Serializer::ObjectProxy

Included in:
ActiveRecordProxy
Defined in:
lib/trick_serial/serializer.rb

Defined Under Namespace

Classes: Error

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clsObject (readonly)

Returns the value of attribute cls.



296
297
298
# File 'lib/trick_serial/serializer.rb', line 296

def cls
  @cls
end

#idObject (readonly)

Returns the value of attribute id.



296
297
298
# File 'lib/trick_serial/serializer.rb', line 296

def id
  @id
end

Class Method Details

.included(target) ⇒ Object



298
299
300
# File 'lib/trick_serial/serializer.rb', line 298

def self.included target
  super
end

Instance Method Details

#initialize(obj, serializer) ⇒ Object



302
303
304
# File 'lib/trick_serial/serializer.rb', line 302

def initialize obj, serializer
  self.object = obj
end

#object=(x) ⇒ Object



311
312
313
314
315
# File 'lib/trick_serial/serializer.rb', line 311

def object= x
  # @object = x
  @cls = x && x.class.name.to_sym
  @id = x && x.id
end

#resolve_classObject



306
307
308
309
# File 'lib/trick_serial/serializer.rb', line 306

def resolve_class
  @resolve_class ||=
    @cls.to_s.split('::').inject(Object){|m, n| m.const_get(n)}
end