Class: Glimmer::DSL::SWT::CustomWidgetExpression
- Inherits:
-
Expression
- Object
- Expression
- Glimmer::DSL::SWT::CustomWidgetExpression
- Includes:
- ParentExpression, TopLevelExpression
- Defined in:
- lib/glimmer/dsl/swt/custom_widget_expression.rb
Instance Method Summary collapse
- #add_content(parent, &block) ⇒ Object
- #can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
- #interpret(parent, keyword, *args, &block) ⇒ Object
Instance Method Details
#add_content(parent, &block) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/glimmer/dsl/swt/custom_widget_expression.rb', line 29 def add_content(parent, &block) # TODO consider avoiding source_location if block.source_location == parent.content&.__getobj__.source_location parent.content.call(parent) unless parent.content.called? else super end end |
#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
17 18 19 20 21 22 |
# File 'lib/glimmer/dsl/swt/custom_widget_expression.rb', line 17 def can_interpret?(parent, keyword, *args, &block) = UI::CustomWidget.for(keyword) and (parent.respond_to?(:swt_widget) or .ancestors.include?(UI::CustomShell)) end |
#interpret(parent, keyword, *args, &block) ⇒ Object
24 25 26 27 |
# File 'lib/glimmer/dsl/swt/custom_widget_expression.rb', line 24 def interpret(parent, keyword, *args, &block) = args.last.is_a?(Hash) ? args.pop : {} UI::CustomWidget.for(keyword).new(parent, *args, , &block) end |