Sha256: f7049374069a80371f19409dcdbc47344b9481c58431e0fd368d649af8f84e4a
Contents?: true
Size: 1.12 KB
Versions: 8
Compression:
Stored size: 1.12 KB
Contents
require 'glimmer/error' require 'glimmer/dsl/engine' require 'glimmer/dsl/expression' module Glimmer module DSL # 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 StaticExpression < Expression class << self def inherited(base) Glimmer::DSL::Engine.add_static_expression(base.new) super end def keyword @keyword ||= name.split(/::/).last.sub(/Expression$/, '').underscore end end # Subclasses may optionally implement def can_interpret?(parent, keyword, *args, &block) true end end end end
Version data entries
8 entries across 8 versions & 2 rubygems