Class: Struct

Inherits:
Object show all
Defined in:
lib/crazy_ivan/vendor/json-1.1.7/lib/json/add/core.rb

Direct Known Subclasses

TC_JSONAddition::MyJsonStruct

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.json_create(object) ⇒ Object



93
94
95
# File 'lib/crazy_ivan/vendor/json-1.1.7/lib/json/add/core.rb', line 93

def self.json_create(object)
  new(*object['v'])
end

Instance Method Details

#to_json(*args) ⇒ Object



97
98
99
100
101
102
103
104
# File 'lib/crazy_ivan/vendor/json-1.1.7/lib/json/add/core.rb', line 97

def to_json(*args)
  klass = self.class.name
  klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
  {
    'json_class' => klass,
    'v'     => values,
  }.to_json(*args)
end