Module: Lustr::WidgetBase
- Included in:
- Gadget, TemplatedWidget, XmlBasedWidget
- Defined in:
- lib/lustr/widget.rb
Instance Attribute Summary collapse
-
#eval_context ⇒ Object
Returns the value of attribute eval_context.
-
#gadget ⇒ Object
Returns the value of attribute gadget.
-
#label ⇒ Object
Returns the value of attribute label.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #<<(child) ⇒ Object
- #_add(child) ⇒ Object
- #children ⇒ Object
- #controller=(thing) ⇒ Object
- #init_options(options) ⇒ Object
- #option(name) ⇒ Object
- #raise_event(expr, event = nil) ⇒ Object
- #resolve ⇒ Object
- #resolve_parent ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#eval_context ⇒ Object
Returns the value of attribute eval_context.
22 23 24 |
# File 'lib/lustr/widget.rb', line 22 def eval_context @eval_context end |
#gadget ⇒ Object
Returns the value of attribute gadget.
22 23 24 |
# File 'lib/lustr/widget.rb', line 22 def gadget @gadget end |
#label ⇒ Object
Returns the value of attribute label.
22 23 24 |
# File 'lib/lustr/widget.rb', line 22 def label @label end |
#name ⇒ Object
Returns the value of attribute name.
22 23 24 |
# File 'lib/lustr/widget.rb', line 22 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
23 24 25 |
# File 'lib/lustr/widget.rb', line 23 def @options end |
#parent ⇒ Object
Returns the value of attribute parent.
22 23 24 |
# File 'lib/lustr/widget.rb', line 22 def parent @parent end |
Instance Method Details
#<<(child) ⇒ Object
30 31 32 |
# File 'lib/lustr/widget.rb', line 30 def <<(child) _add(child) end |
#_add(child) ⇒ Object
34 35 36 37 |
# File 'lib/lustr/widget.rb', line 34 def _add(child) children << child child.parent=self end |
#children ⇒ Object
25 26 27 28 |
# File 'lib/lustr/widget.rb', line 25 def children @children||=[] @children end |
#controller=(thing) ⇒ Object
55 56 57 |
# File 'lib/lustr/widget.rb', line 55 def controller=(thing) gadget.controller=thing end |
#init_options(options) ⇒ Object
47 48 49 |
# File 'lib/lustr/widget.rb', line 47 def () @options= end |
#option(name) ⇒ Object
51 52 53 |
# File 'lib/lustr/widget.rb', line 51 def option(name) return [name] end |
#raise_event(expr, event = nil) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/lustr/widget.rb', line 59 def raise_event(expr, event=nil) if expr if expr.kind_of?(Proc) expr.call(event, gadget) elsif expr.kind_of?(Symbol) gadget.controller.send(expr, event) if gadget.controller else gadget.controller.instance_eval(expr) if gadget.controller end end end |
#resolve ⇒ Object
39 40 41 |
# File 'lib/lustr/widget.rb', line 39 def resolve return self end |
#resolve_parent ⇒ Object
43 44 45 |
# File 'lib/lustr/widget.rb', line 43 def resolve_parent return self end |
#to_s ⇒ Object
71 72 73 74 |
# File 'lib/lustr/widget.rb', line 71 def to_s return label if label return super end |