Class: Glimmer::DSL::StaticExpression
- Inherits:
-
Expression
- Object
- Expression
- Glimmer::DSL::StaticExpression
- Defined in:
- lib/glimmer/dsl/static_expression.rb
Overview
Represents a StaticExpression for expressions where the keyword does not vary dynamically. These static keywords are then predefined as methods in Glimmer instead of needing method_missing
StaticExpression subclasses may optionally implement ‘#can_interpret?` (not needed if it only checks for keyword)
StaticExpression subclasses must define ‘#interpret`.
The direct parent namespace of a StaticExpression subclass must match the DSL name (case-insensitive) (e.g. Glimmer::DSL::SWT::WidgetExpression has a DSL of :swt)
Class Method Summary collapse
Instance Method Summary collapse
-
#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
Subclasses may optionally implement.
Methods inherited from Expression
#add_content, dsl, #interpret, #textual?
Class Method Details
.inherited(base) ⇒ Object
43 44 45 46 |
# File 'lib/glimmer/dsl/static_expression.rb', line 43 def inherited(base) Glimmer::DSL::Engine.add_static_expression(base.new) super end |
.keyword ⇒ Object
48 49 50 |
# File 'lib/glimmer/dsl/static_expression.rb', line 48 def keyword @keyword ||= name.split(/::/).last.sub(/Expression$/, '').underscore end |
Instance Method Details
#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean
Subclasses may optionally implement
54 55 56 |
# File 'lib/glimmer/dsl/static_expression.rb', line 54 def can_interpret?(parent, keyword, *args, &block) true end |