Class: Apotomo::WidgetShortcuts::FactoryProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/apotomo/widget_shortcuts.rb

Instance Method Summary collapse

Constructor Details

#initialize(prefix, *args, &block) ⇒ FactoryProxy

Returns a new instance of FactoryProxy.



36
37
38
39
40
41
# File 'lib/apotomo/widget_shortcuts.rb', line 36

def initialize(prefix, *args, &block)
  options = args.extract_options!
  id      = args.shift || prefix
  
  @prefix, @id, @options, @block = prefix, id, options, block
end

Instance Method Details

#build(parent) ⇒ Object



43
44
45
46
47
# File 'lib/apotomo/widget_shortcuts.rb', line 43

def build(parent)
  widget = constant_for(@prefix).new(parent, @id, @options)
  @block.call(widget) if @block
  widget
end