Class: Hanuman::LinkFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/hanuman/link.rb

Constant Summary collapse

Registry =
{
  simple: ->(from_stage, *into_stage){ DirectedLink.new(from_stage, *into_stage) }
}

Class Method Summary collapse

Class Method Details

.connect(label, from_stage, *into_stage) ⇒ Object



10
11
12
# File 'lib/hanuman/link.rb', line 10

def connect(label, from_stage, *into_stage)
  Registry[label].call(from_stage, *into_stage)
end

.register(label, factory_method) ⇒ Object



14
15
16
# File 'lib/hanuman/link.rb', line 14

def register(label, factory_method)
  Registry[label] = factory_method
end