Class: Lustr::SimpleBuilder
- Inherits:
-
BuilderBase
- Object
- BuilderBase
- Lustr::SimpleBuilder
- Defined in:
- lib/lustr/builder.rb
Overview
SimpleBuilder handles the really simple case where a builder simply instantiates some widget class. Then, rather than having to create custom builder subclasses for each widget class, you can simply Lustr.declare()
an instance of SimpleBuilder with the appropriate widget class as a parameter.
Instance Attribute Summary
Attributes inherited from BuilderBase
#children, #event_handlers, #name, #options, #widget_type
Instance Method Summary collapse
- #build(parent_widget) ⇒ Object
- #dup_from(options) ⇒ Object
-
#initialize(widget_type, klass, options = {}) ⇒ SimpleBuilder
constructor
A new instance of SimpleBuilder.
Methods inherited from BuilderBase
#<<, #all_event_handlers, #build_all
Constructor Details
#initialize(widget_type, klass, options = {}) ⇒ SimpleBuilder
Returns a new instance of SimpleBuilder.
103 104 105 106 |
# File 'lib/lustr/builder.rb', line 103 def initialize(, klass, ={}) super(, ) @widget_class=klass end |
Instance Method Details
#build(parent_widget) ⇒ Object
112 113 114 |
# File 'lib/lustr/builder.rb', line 112 def build() @widget_class.new end |
#dup_from(options) ⇒ Object
108 109 110 |
# File 'lib/lustr/builder.rb', line 108 def dup_from() self.class.new(, @widget_class, ) end |