Class: TC_JSONAddition::A

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a) ⇒ A

Returns a new instance of A.



17
18
19
# File 'lib/crazy_ivan/vendor/json-1.1.7/tests/test_json_addition.rb', line 17

def initialize(a)
  @a = a
end

Instance Attribute Details

#aObject (readonly)

Returns the value of attribute a.



21
22
23
# File 'lib/crazy_ivan/vendor/json-1.1.7/tests/test_json_addition.rb', line 21

def a
  @a
end

Class Method Details

.json_create(object) ⇒ Object



27
28
29
# File 'lib/crazy_ivan/vendor/json-1.1.7/tests/test_json_addition.rb', line 27

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

Instance Method Details

#==(other) ⇒ Object



23
24
25
# File 'lib/crazy_ivan/vendor/json-1.1.7/tests/test_json_addition.rb', line 23

def ==(other)
  a == other.a
end

#to_json(*args) ⇒ Object



31
32
33
34
35
36
# File 'lib/crazy_ivan/vendor/json-1.1.7/tests/test_json_addition.rb', line 31

def to_json(*args)
  {
    'json_class'  => self.class.name,
    'args'        => [ @a ],
  }.to_json(*args)
end