Sha256: 01820d77b243641776e7e6300e1877df0c93b99ed6148d440fcb6a0608405593

Contents?: true

Size: 615 Bytes

Versions: 3

Compression:

Stored size: 615 Bytes

Contents

# frozen_string_literal: true

class RedBlackTree
  class Node
    module LeftRightElementReferencers # @private
      def [] direction
        case direction
        when Node::LEFT then @left
        when Node::RIGHT then @right
        else raise ArgumentError, "Direction must be one of #{Implementation::DIRECTIONS}"
        end
      end

      def []= direction, node
        case direction
        when Node::LEFT then @left = node
        when Node::RIGHT then @right = node
        else raise ArgumentError, "Direction must be one of #{Implementation::DIRECTIONS}"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
red-black-tree-0.1.5 lib/red_black_tree/node/left_right_element_referencers.rb
red-black-tree-0.1.4 lib/red_black_tree/node/left_right_element_referencers.rb
red-black-tree-0.1.3 lib/red_black_tree/node/left_right_element_referencers.rb