Sha256: 595bc688dafb7c75989a4b9b41b5d4d2dbc3263c9ea0e7b534ef4799d20417ab

Contents?: true

Size: 368 Bytes

Versions: 1

Compression:

Stored size: 368 Bytes

Contents

module GraphBuilder
  module Linkable

    # links other to self
    def link_to other
      linked_to << other
    end

    # returns array of objects to which self is linked
    def linked_to
      @linked_to ||= []
    end

    # returns array of [ self, object ] where each object linked to self
    def links
      linked_to.map{|to|[self,to]}
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graph_builder-1.0.1 lib/graph_builder/linkable.rb