Class: Set

Inherits:
Object
  • Object
show all
Defined in:
lib/json/add/set.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.json_create(object) ⇒ Object

Import a JSON Marshalled object.

method used for JSON marshalling support.


10
11
12
# File 'lib/json/add/set.rb', line 10

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

Instance Method Details

#as_jsonObject

Marshal the object to JSON.

method used for JSON marshalling support.


17
18
19
20
21
22
# File 'lib/json/add/set.rb', line 17

def as_json(*)
  {
    JSON.create_id => self.class.name,
    'a'            => to_a,
  }
end

#to_json(*args) ⇒ Object

return the JSON value


25
26
27
# File 'lib/json/add/set.rb', line 25

def to_json(*args)
  as_json.to_json(*args)
end