Class: Lustr::Gadget
- Inherits:
-
BlankSlate
- Object
- BlankSlate
- Lustr::Gadget
- Includes:
- WidgetBase
- Defined in:
- lib/lustr/gadget.rb
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#parent_widget ⇒ Object
readonly
Returns the value of attribute parent_widget.
-
#widgets ⇒ Object
readonly
Returns the value of attribute widgets.
Attributes included from WidgetBase
#eval_context, #gadget, #label, #name, #options, #parent
Instance Method Summary collapse
- #contents(ctxt) ⇒ Object
- #generate(ctxt) ⇒ Object
-
#initialize(builder, parent_widget = nil, ctlr = NullController, options = {}) ⇒ Gadget
constructor
A new instance of Gadget.
- #method_missing(sym, *args) ⇒ Object
- #resolve ⇒ Object
- #resolve_parent ⇒ Object
- #show ⇒ Object
Methods included from WidgetBase
#<<, #_add, #children, #init_options, #option, #raise_event, #to_s
Constructor Details
#initialize(builder, parent_widget = nil, ctlr = NullController, options = {}) ⇒ Gadget
Returns a new instance of Gadget.
25 26 27 28 29 30 |
# File 'lib/lustr/gadget.rb', line 25 def initialize(builder, =nil, ctlr=NullController, ={}) @builder=builder @widgets={} @parent_widget= self.controller=ctlr end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
67 68 69 70 71 72 |
# File 'lib/lustr/gadget.rb', line 67 def method_missing(sym, *args) result=[sym.to_s] return result if result return super end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
22 23 24 |
# File 'lib/lustr/gadget.rb', line 22 def builder @builder end |
#controller ⇒ Object
Returns the value of attribute controller.
23 24 25 |
# File 'lib/lustr/gadget.rb', line 23 def controller @controller end |
#parent_widget ⇒ Object (readonly)
Returns the value of attribute parent_widget.
22 23 24 |
# File 'lib/lustr/gadget.rb', line 22 def @parent_widget end |
#widgets ⇒ Object (readonly)
Returns the value of attribute widgets.
22 23 24 |
# File 'lib/lustr/gadget.rb', line 22 def @widgets end |
Instance Method Details
#contents(ctxt) ⇒ Object
63 64 65 |
# File 'lib/lustr/gadget.rb', line 63 def contents(ctxt) ctxt.build_gadget_ref(self) end |
#generate(ctxt) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/lustr/gadget.rb', line 53 def generate(ctxt) if contents(ctxt) else children.each do |child| child.generate(ctxt) end end end |
#resolve ⇒ Object
38 39 40 41 |
# File 'lib/lustr/gadget.rb', line 38 def resolve return children[0].resolve if children.size>0 return super end |
#resolve_parent ⇒ Object
43 44 45 |
# File 'lib/lustr/gadget.rb', line 43 def resolve_parent return end |
#show ⇒ Object
47 48 49 50 51 |
# File 'lib/lustr/gadget.rb', line 47 def show children.each do |child| child.show end end |