In Files

  • json/lib/json/add/core.rb

Parent

Struct

Public Class Methods

json_create(object) click to toggle source
 
               # File json/lib/json/add/core.rb, line 106
def self.json_create(object)
  new(*object['v'])
end
            

Public Instance Methods

to_json(*args) click to toggle source
 
               # File json/lib/json/add/core.rb, line 110
def to_json(*args)
  klass = self.class.name
  klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!"
  {
    JSON.create_id => klass,
    'v'     => values,
  }.to_json(*args)
end