Method: Highway::Compiler::Analyze::Tree::Values::Base#select_variable_segments

Defined in:
lib/highway/compiler/analyze/tree/values/base.rb

#select_variable_segments(&block) ⇒ Array<Highway::Compiler::Analyze::Tree::Segments::Variable>

The flat array of variable segments which satisfy the given block.

Parameters:

  • &block (Block)

    The selection block.

Returns:



44
45
46
47
48
49
50
# File 'lib/highway/compiler/analyze/tree/values/base.rb', line 44

def select_variable_segments(&block)
  if block_given?
    select_segments { |s| s.is_a?(Segments::Variable) && block.call(s) }
  else
    select_segments { |s| s.is_a?(Segments::Variable) }
  end
end