Class: RuboCop::AST::NodePattern::Compiler::NodePatternSubcompiler

Inherits:
Subcompiler
  • Object
show all
Defined in:
lib/rubocop/ast/node_pattern/compiler/node_pattern_subcompiler.rb

Overview

Compiles code that evalues to true or false for a given value ‘var` (typically a RuboCop::AST::Node) or it’s ‘node.type` if `seq_head` is true

Doc on how this fits in the compiling process:

/docs/modules/ROOT/pages/node_pattern.adoc

Direct Known Subclasses

Debug::NodePatternSubcompiler

Instance Attribute Summary collapse

Attributes inherited from Subcompiler

#compiler

Instance Method Summary collapse

Methods inherited from Subcompiler

#compile, inherited, method_added

Constructor Details

#initialize(compiler, var: nil, access: var, seq_head: false) ⇒ NodePatternSubcompiler

Returns a new instance of NodePatternSubcompiler.



16
17
18
19
20
21
# File 'lib/rubocop/ast/node_pattern/compiler/node_pattern_subcompiler.rb', line 16

def initialize(compiler, var: nil, access: var, seq_head: false)
  super(compiler)
  @var = var
  @access = access
  @seq_head = seq_head
end

Instance Attribute Details

#accessObject (readonly)

Returns the value of attribute access.



14
15
16
# File 'lib/rubocop/ast/node_pattern/compiler/node_pattern_subcompiler.rb', line 14

def access
  @access
end

#seq_headObject (readonly)

Returns the value of attribute seq_head.



14
15
16
# File 'lib/rubocop/ast/node_pattern/compiler/node_pattern_subcompiler.rb', line 14

def seq_head
  @seq_head
end