Sha256: 3062b4868ef5d4032a73fc69b45e2d431cd52a26749008d684d932d779e364b0

Contents?: true

Size: 301 Bytes

Versions: 2

Compression:

Stored size: 301 Bytes

Contents

module DagLinkCalculator
  NodeRoute = Struct.new(:nodes) do
    def size
      nodes.size
    end

    def direct?
      size == 2
    end

    def descendant_id
      nodes.first
    end

    def ancestor_id
      nodes.last
    end

    def <=>(other)
      nodes <=> other.nodes
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dag_link_calculator-1.0.0 lib/dag_link_calculator/node_route.rb
dag_link_calculator-0.1.0 lib/dag_link_calculator/node_route.rb