Class: Rosette::Core::PathMatcherFactory::BinaryNode

Inherits:
Node
  • Object
show all
Defined in:
lib/rosette/core/path_matcher_factory.rb

Overview

The base class for all nodes that perform binary operations (i.e. operations that take two operands).

Direct Known Subclasses

AndNode, OrNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#matches?

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

#initialize(left, right) ⇒ BinaryNode

Creates a new binary node with left and right children.

Parameters:

  • left (Node)

    The left child.

  • right (Node)

    The right child.


152
153
154
155
# File 'lib/rosette/core/path_matcher_factory.rb', line 152

def initialize(left, right)
  @left = left
  @right = right
end

Instance Attribute Details

#leftNode (readonly)

Returns the left child.

Returns:

  • (Node)

    the left child.


145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/rosette/core/path_matcher_factory.rb', line 145

class BinaryNode < Node
  attr_reader :left, :right

  # Creates a new binary node with left and right children.
  #
  # @param [Node] left The left child.
  # @param [Node] right The right child.
  def initialize(left, right)
    @left = left
    @right = right
  end
end

#rightNode (readonly)

Returns the right child.

Returns:

  • (Node)

    the right child.


145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/rosette/core/path_matcher_factory.rb', line 145

class BinaryNode < Node
  attr_reader :left, :right

  # Creates a new binary node with left and right children.
  #
  # @param [Node] left The left child.
  # @param [Node] right The right child.
  def initialize(left, right)
    @left = left
    @right = right
  end
end