Sha256: d26053685b056337fd233448e51c59eeda945cb92407a5f92ddd7424f4cf8c77

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

#
# Copyright (c) 2018-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

require 'acts_as_hashable'
require 'ostruct'

require_relative 'comparator'
require_relative 'node'
require_relative 'simple_node'
require_relative 'processor'

# Top-level namespace of the library.  The methods contained here should be considered the
# main public API.
module TreeBranch
  class << self
    def process(node: {}, context: {}, comparators: [], &block)
      ::TreeBranch::Processor.new
                             .process(
                               normalize_node(node),
                               context: context,
                               comparators: comparators,
                               &block
                             )
    end

    private

    def normalize_node(node)
      node.is_a?(::TreeBranch::Node) ? node : ::TreeBranch::SimpleNode.make(node, nullable: false)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tree_branch-1.1.1 lib/tree_branch/tree_branch.rb
tree_branch-1.1.0 lib/tree_branch/tree_branch.rb
tree_branch-1.0.0 lib/tree_branch/tree_branch.rb