Class: ASTUtils::Scope::Assignment
- Inherits:
-
Object
- Object
- ASTUtils::Scope::Assignment
- Defined in:
- lib/ast_utils/scope.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#variable ⇒ Object
readonly
Returns the value of attribute variable.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(node:, variable:) ⇒ Assignment
constructor
A new instance of Assignment.
Constructor Details
#initialize(node:, variable:) ⇒ Assignment
Returns a new instance of Assignment.
6 7 8 9 |
# File 'lib/ast_utils/scope.rb', line 6 def initialize(node:, variable:) @node = node @variable = variable end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
4 5 6 |
# File 'lib/ast_utils/scope.rb', line 4 def node @node end |
#variable ⇒ Object (readonly)
Returns the value of attribute variable.
4 5 6 |
# File 'lib/ast_utils/scope.rb', line 4 def variable @variable end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 |
# File 'lib/ast_utils/scope.rb', line 19 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
15 16 17 |
# File 'lib/ast_utils/scope.rb', line 15 def eql?(other) other.is_a?(Assignment) && other.node.__id__ == node.__id__ && other.variable == variable end |
#hash ⇒ Object
11 12 13 |
# File 'lib/ast_utils/scope.rb', line 11 def hash node.__id__ ^ variable.hash end |