class Fathom::Edge

Public Class Methods

infer(obj, optional_child=nil) click to toggle source
# 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
new(attributes={}) click to toggle source
# File lib/fathom/data/edge.rb, line 35
def initialize(attributes={})
  attributes[:parent] = Variable.infer(attributes[:parent])
  attributes[:child] = Variable.infer(attributes[:child])
  @attributes = attributes
end

Public Instance Methods

==(other)
Alias for: eql
child=(obj) click to toggle source
# File lib/fathom/data/edge.rb, line 48
def child=(obj)
  send(self.class.attributes_proxy)[:child] = Variable.infer(obj)
end
eql(other) click to toggle source
# 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
Also aliased as: ==
parent=(obj) click to toggle source

Override setters on parent and child to ensure Variables =

# File lib/fathom/data/edge.rb, line 44
def parent=(obj)
  send(self.class.attributes_proxy)[:parent] = Variable.infer(obj)
end