Class: Glimmer::DSL::Libui::StringExpression
- Inherits:
-
Expression
- Object
- Expression
- Glimmer::DSL::Libui::StringExpression
- Includes:
- ParentExpression
- Defined in:
- lib/glimmer/dsl/libui/string_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
48 49 50 51 52 |
# File 'lib/glimmer/dsl/libui/string_expression.rb', line 48 def add_content(parent, keyword, *args, &block) = args.last.is_a?(Hash) ? args.last : {} [:post_add_content] = true if !.include?(:post_add_content) parent&.post_add_content(block) if [:post_add_content] end |
#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
32 33 34 35 36 37 38 |
# File 'lib/glimmer/dsl/libui/string_expression.rb', line 32 def can_interpret?(parent, keyword, *args, &block) keyword == 'string' and ( parent.is_a?(Glimmer::LibUI::ControlProxy::TextProxy) or (parent.is_a?(Glimmer::LibUI::AttributedString) and !args.empty?) ) end |
#interpret(parent, keyword, *args, &block) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/glimmer/dsl/libui/string_expression.rb', line 40 def interpret(parent, keyword, *args, &block) if parent.is_a?(Glimmer::LibUI::ControlProxy::TextProxy) Glimmer::LibUI::AttributedString.new(keyword, parent, args, &block) else parent.string = args.join end end |