Module: Kantox::Split::Graph

Defined in:
lib/kantox/split/graph.rb

Defined Under Namespace

Modules: Attributed, Edge, Vertex

Constant Summary collapse

CONFIGURE_EVALUATOR =
<<-EOCFGEV
  def configure_%{entity} parameter = nil, &cb
    store_variable :graph_%{entity}_getter, parameter || cb
    class_eval do
      def %{entity}
        lookup_variable_value lookup_variable :graph_%{entity}_getter
      end
    end
  end
EOCFGEV

Class Method Summary collapse

Class Method Details

.tree(root, depth = -1) ⇒ Object



120
121
122
123
124
125
126
127
128
# File 'lib/kantox/split/graph.rb', line 120

def self.tree root, depth = -1
  return nil unless root.respond_to? :vertices

  root.vertices.inject({}) do |memo, v|
    memo[v] = { vertex: v }

    memo
  end
end