Class: Fathom::Edge
- Inherits:
-
Object
- Object
- Fathom::Edge
- Extended by:
- Plugins
- Defined in:
- lib/fathom/data/edge.rb
Class Method Summary collapse
Instance Method Summary collapse
- #child=(obj) ⇒ Object
- #eql(other) ⇒ Object (also: #==)
-
#initialize(attributes = {}) ⇒ Edge
constructor
A new instance of Edge.
-
#parent=(obj) ⇒ Object
= Override setters on parent and child to ensure Variables = ============================================================.
Methods included from Plugins
Constructor Details
Class Method Details
.infer(obj, optional_child = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fathom/data/edge.rb', line 8 def infer(obj, optional_child=nil) return new(:parent => Variable.infer(obj), :child => Variable.infer(optional_child)) if optional_child case obj when Edge obj when Array new(:parent => Variable.infer(obj[0]), :child => Variable.infer(obj[1])) when Hash new(obj) end end |
Instance Method Details
#child=(obj) ⇒ Object
48 49 50 |
# File 'lib/fathom/data/edge.rb', line 48 def child=(obj) send(self.class.attributes_proxy)[:child] = Variable.infer(obj) end |
#eql(other) ⇒ Object Also known as: ==
52 53 54 55 |
# File 'lib/fathom/data/edge.rb', line 52 def eql(other) return false unless other.is_a?(Edge) self.parent == other.parent and self.child == other.child end |