Class: Rosette::Core::PathMatcherFactory::OrNode

Inherits:
BinaryNode show all
Defined in:
lib/rosette/core/path_matcher_factory.rb

Overview

A logical “OR”.

Instance Attribute Summary

Attributes inherited from BinaryNode

#left, #right

Instance Method Summary collapse

Methods inherited from BinaryNode

#initialize

Methods included from NodeOperatorFactory

#and, #not, #or

Methods included from NodeFactory

#match_file_extension, #match_file_extensions, #match_path, #match_paths, #match_regex, #match_regexes

Constructor Details

This class inherits a constructor from Rosette::Core::PathMatcherFactory::BinaryNode

Instance Method Details

#matches?(path) ⇒ Boolean

Determines if the given path matches the left OR the right child's conditions.

Parameters:

  • path (String)

    The path to match.

Returns:

  • (Boolean)

    true if the left or the right child matches path, false otherwise.


202
203
204
# File 'lib/rosette/core/path_matcher_factory.rb', line 202

def matches?(path)
  left.matches?(path) || right.matches?(path)
end

#to_sString

Generates a string representation of this node.

Returns:

  • (String)

209
210
211
# File 'lib/rosette/core/path_matcher_factory.rb', line 209

def to_s
  "(#{left.to_s} OR #{right.to_s})"
end