Class: Embedly::EmbedlyObject

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/embedly/model.rb

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ EmbedlyObject

Resursively make ostruct



6
7
8
9
10
11
12
13
14
# File 'lib/embedly/model.rb', line 6

def initialize obj
  o = obj.clone
  o.each do |k,v|
    if v.is_a?Hash
      o[k] = Embedly::EmbedlyObject.new v
    end
  end
  super o
end

Instance Method Details

#marshal_dumpObject



22
23
24
25
26
27
28
29
30
# File 'lib/embedly/model.rb', line 22

def marshal_dump
  o = @table.clone
  o.each do |k,v|
    if v.is_a?Embedly::EmbedlyObject
      o[k] = v.marshal_dump
    end
  end
  return o
end

#typeObject

for ruby 1.8.x, type should return @table, not the class.



18
19
20
# File 'lib/embedly/model.rb', line 18

def type
  method_missing :type
end