class Set
def as_json(*)
Set.json_create(x) # => #
\Method +JSON.create+ deserializes such a hash, returning a \Set object:
# => {"json_class"=>"Set", "a"=>["foo", "bar", "baz"]}
x = Set.new(%w/foo bar baz/).as_json
require 'json/add/set'
returning a 2-element hash representing +self+:
\Method Set#as_json serializes +self+,
see Marshal[https://docs.ruby-lang.org/en/master/Marshal.html].
to serialize and deserialize a \Set object;
Methods Set#as_json and +Set.json_create+ may be used
def as_json(*) { JSON.create_id => self.class.name, 'a' => to_a, } end