Module: GraphBuilder::Linkable
- Defined in:
- lib/graph_builder/linkable.rb
Instance Method Summary collapse
-
#link_to(other) ⇒ Object
links other to self.
-
#linked_to ⇒ Object
returns array of objects to which self is linked.
-
#links ⇒ Object
returns array of [ self, object ] where each object linked to self.
Instance Method Details
#link_to(other) ⇒ Object
links other to self
5 6 7 |
# File 'lib/graph_builder/linkable.rb', line 5 def link_to other linked_to << other end |
#linked_to ⇒ Object
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 |
#links ⇒ Object
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 |