Class: Glimmer::DSL::SWT::CustomShapeExpression
- Inherits:
-
Expression
- Object
- Expression
- Glimmer::DSL::SWT::CustomShapeExpression
- Includes:
- ParentExpression, TopLevelExpression
- Defined in:
- lib/glimmer/dsl/swt/custom_shape_expression.rb
Instance Method Summary collapse
- #add_content(parent, keyword, *args, &block) ⇒ Object
- #can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
- #interpret(parent, keyword, *args, &block) ⇒ Object
Instance Method Details
#add_content(parent, keyword, *args, &block) ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/glimmer/dsl/swt/custom_shape_expression.rb', line 49 def add_content(parent, keyword, *args, &block) # TODO consider avoiding source_location return if block&.parameters&.count == 2 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
38 39 40 |
# File 'lib/glimmer/dsl/swt/custom_shape_expression.rb', line 38 def can_interpret?(parent, keyword, *args, &block) !!UI::CustomShape.for(keyword) end |
#interpret(parent, keyword, *args, &block) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/glimmer/dsl/swt/custom_shape_expression.rb', line 42 def interpret(parent, keyword, *args, &block) = args.last.is_a?(Hash) ? args.pop : {} UI::CustomShape.for(keyword).new(parent, *args, , &block).tap do |new_custom_shape| new_custom_shape.body_root.paint_pixel_by_pixel(&block) if block&.parameters&.count == 2 end end |