Module: GraphBuilder::Linkable

Defined in:
lib/graph_builder/linkable.rb

Instance Method Summary collapse

Instance Method Details

links other to self



5
6
7
# File 'lib/graph_builder/linkable.rb', line 5

def link_to other
  linked_to << other
end

#linked_toObject

returns array of objects to which self is linked



10
11
12
# File 'lib/graph_builder/linkable.rb', line 10

def linked_to
  @linked_to ||= []
end

returns array of [ self, object ] where each object linked to self



15
16
17
# File 'lib/graph_builder/linkable.rb', line 15

def links
  linked_to.map{|to|[self,to]}
end