Method: Hanuman::Shortcuts#builder_shortcut

Defined in:
lib/hanuman.rb

#builder_shortcut(builder_type, label, *args, &blk) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/hanuman.rb', line 13

def builder_shortcut(builder_type, label, *args, &blk)
  if GlobalRegistry.registered?(label)
    builder = GlobalRegistry.retrieve(label)
  else
    builder = builder_type.receive(label: label)
  end
  GlobalRegistry.decorate_with_registry(builder) if builder.is_a?(GraphBuilder)
  builder.define(*args, &blk)
end