Class: Rosette::Core::PathMatcherFactory::AndNode

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

Overview

A logical “and”.

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 AND the right child's conditions.

Parameters:

  • path (String)

    The path to match.

Returns:

  • (Boolean)

    true if both the left and right children match path, false otherwise.


182
183
184
# File 'lib/rosette/core/path_matcher_factory.rb', line 182

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

#to_sString

Generates a string representation of this node.

Returns:

  • (String)

189
190
191
# File 'lib/rosette/core/path_matcher_factory.rb', line 189

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