Class: ASTUtils::Labeling::LabeledName
- Inherits:
-
Object
- Object
- ASTUtils::Labeling::LabeledName
- Defined in:
- lib/ast_utils/labeling.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #equal?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name:, label:) ⇒ LabeledName
constructor
A new instance of LabeledName.
- #inspect ⇒ Object
Constructor Details
#initialize(name:, label:) ⇒ LabeledName
Returns a new instance of LabeledName.
7 8 9 10 |
# File 'lib/ast_utils/labeling.rb', line 7 def initialize(name:, label:) @name = name @label = label end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
5 6 7 |
# File 'lib/ast_utils/labeling.rb', line 5 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/ast_utils/labeling.rb', line 4 def name @name end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 |
# File 'lib/ast_utils/labeling.rb', line 20 def ==(other) other.is_a?(LabeledName) && other.name == name && other.label == label end |
#eql?(other) ⇒ Boolean
28 29 30 |
# File 'lib/ast_utils/labeling.rb', line 28 def eql?(other) self == other end |
#equal?(other) ⇒ Boolean
24 25 26 |
# File 'lib/ast_utils/labeling.rb', line 24 def equal?(other) self == other end |
#hash ⇒ Object
16 17 18 |
# File 'lib/ast_utils/labeling.rb', line 16 def hash name.hash ^ label.hash end |
#inspect ⇒ Object
12 13 14 |
# File 'lib/ast_utils/labeling.rb', line 12 def inspect "#{name}@#{label}" end |