Sha256: 288a70816824dee4afbdc95a0e0c9801b8bfde0bc5b71dde2dd628eba0b35c8e

Contents?: true

Size: 539 Bytes

Versions: 3

Compression:

Stored size: 539 Bytes

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.
#

module TreeBranch
  # A basic subclass of Node that makes the data element a deterministic and comparable OpenStruct
  # object.
  class SimpleNode < Node
    acts_as_hashable

    def initialize(data: {}, children: [])
      @data     = OpenStruct.new(data)
      @children = self.class.array(children)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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