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