Class: TC_JSONRails::A

Inherits:
Object show all
Defined in:
lib/vendor/json_pure/tests/test_json_rails.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/vendor/json_pure/tests/test_json_rails.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/vendor/json_pure/tests/test_json_rails.rb', line 21

def a
  @a
end

Class Method Details

.json_create(object) ⇒ Object



27
28
29
# File 'lib/vendor/json_pure/tests/test_json_rails.rb', line 27

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

Instance Method Details

#==(other) ⇒ Object



23
24
25
# File 'lib/vendor/json_pure/tests/test_json_rails.rb', line 23

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

#to_json(*args) ⇒ Object



31
32
33
34
35
36
# File 'lib/vendor/json_pure/tests/test_json_rails.rb', line 31

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