Class: Querly::Pattern::Expr::Ivar

Inherits:
Base
  • Object
show all
Defined in:
lib/querly/pattern/expr.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #=~, #attributes

Constructor Details

#initialize(name:) ⇒ Ivar

Returns a new instance of Ivar.



345
346
347
# File 'lib/querly/pattern/expr.rb', line 345

def initialize(name:)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



343
344
345
# File 'lib/querly/pattern/expr.rb', line 343

def name
  @name
end

Instance Method Details

#test_node(node) ⇒ Object



349
350
351
352
353
# File 'lib/querly/pattern/expr.rb', line 349

def test_node(node)
  if node&.type == :ivar
    name.nil? || node.children.first == name
  end
end