Class: Attribute
- Inherits:
-
Object
- Object
- Attribute
- Defined in:
- lib/json/attribute.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#set_at ⇒ Object
Returns the value of attribute set_at.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #hash_code ⇒ Object
-
#initialize(name = nil, value = nil, set_at = nil) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_s ⇒ Object
Constructor Details
#initialize(name = nil, value = nil, set_at = nil) ⇒ Attribute
Returns a new instance of Attribute.
6 7 8 9 10 |
# File 'lib/json/attribute.rb', line 6 def initialize(name = nil, value = nil, set_at = nil) @name = name @value = value @set_at = set_at end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/json/attribute.rb', line 4 def name @name end |
#set_at ⇒ Object
Returns the value of attribute set_at.
4 5 6 |
# File 'lib/json/attribute.rb', line 4 def set_at @set_at end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/json/attribute.rb', line 4 def value @value end |
Instance Method Details
#==(o) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/json/attribute.rb', line 12 def ==(o) return true if self.object_id == o.object_id return false if o.nil? || self.class != o.class @name == o.name && @value == o.value && @set_at == o.set_at end |
#hash_code ⇒ Object
19 20 21 |
# File 'lib/json/attribute.rb', line 19 def hash_code { name: @name, value: @value, set_at: @set_at } end |
#to_s ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/json/attribute.rb', line 23 def to_s "Attribute{" + "name='#{@name}'" + ", value=#{@value}" + ", setAt=#{@set_at}" + "}" end |