Class: OpenStruct

Inherits:
Object show all
Defined in:
lib/h8/value.rb,
lib/h8/context.rb

Instance Method Summary collapse

Instance Method Details

#__js_enumerateObject



41
42
43
# File 'lib/h8/context.rb', line 41

def __js_enumerate
  to_h.keys.map(&:to_s)
end

#__to_jsonObject



37
38
39
# File 'lib/h8/context.rb', line 37

def __to_json
  JSON.unparse to_h
end

#to_ruby(depth = 0) ⇒ Object

OpenStruct converts to plain ruby hash in depth. Primary usage is when it was used bu javascript and could contain gated objects.



191
192
193
# File 'lib/h8/value.rb', line 191

def to_ruby depth=0
  to_h.to_ruby depth+1
end