Class: Fast::Any

Inherits:
Find
  • Object
show all
Defined in:
lib/fast.rb

Overview

Matches any of the internal expressions. Works like a OR condition.

Examples:

Matchig int or float

Fast.expression("{int float}")

Instance Attribute Summary

Attributes inherited from Find

#token

Instance Method Summary collapse

Methods inherited from Find

#==, #compare_symbol_or_head, #debug, #debug_match_recursive, #initialize, #match_recursive

Constructor Details

This class inherits a constructor from Fast::Find

Instance Method Details

#match?(node) ⇒ Boolean

Returns:

  • (Boolean)


666
667
668
# File 'lib/fast.rb', line 666

def match?(node)
  token.any? { |expression| Fast.match?(expression, node) }
end

#to_sObject



670
671
672
# File 'lib/fast.rb', line 670

def to_s
  "any[#{token.map(&:to_s).join(', ')}]"
end