Class: Graphable::EdgeCreator

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/graphable/edge_creator.rb

Direct Known Subclasses

ThroughEdgeCreator, ViaEdgeCreator

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, target, method, opts) ⇒ EdgeCreator

Returns a new instance of EdgeCreator.



17
18
19
20
21
22
23
24
# File 'lib/graphable/edge_creator.rb', line 17

def initialize(source, target, method, opts)
  @source = source
  @target = target
  @method = method
  @name = opts[:name] || method
  @metadata_proc = opts[:block]
  @target_name = opts[:target_method]
end

Class Method Details

.through(*args) ⇒ Object



7
8
9
10
# File 'lib/graphable/edge_creator.rb', line 7

def self.through(*args)
  # for has_many :through relations
  ThroughEdgeCreator.new(*args) 
end

.via(*args) ⇒ Object



12
13
14
15
# File 'lib/graphable/edge_creator.rb', line 12

def self.via(*args)
  #for habtm/has_many relations
  ViaEdgeCreator.new(*args)
end