Class: EventQ::SerializationProviders::JRuby::Oj::AttributeWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/eventq_base/serialization_providers/jruby/oj/attribute_writer.rb

Class Method Summary collapse

Class Method Details

.descendantsObject



12
13
14
15
16
17
18
19
# File 'lib/eventq_base/serialization_providers/jruby/oj/attribute_writer.rb', line 12

def self.descendants
  descendants = []
  ObjectSpace.each_object(singleton_class) do |k|
    next if k.singleton_class?
    descendants.unshift k unless k == self
  end
  descendants
end

.exec(obj) ⇒ Object



7
8
9
10
# File 'lib/eventq_base/serialization_providers/jruby/oj/attribute_writer.rb', line 7

def self.exec(obj)
  aw = descendants.detect { |a| a.new.valid?(obj) } || ClassWriter
  aw.new.exec(obj)
end