Class: Glimmer::DSL::XML::TagExpression

Inherits:
StaticExpression show all
Includes:
TopLevelExpression, NodeParentExpression
Defined in:
lib/glimmer/dsl/xml/tag_expression.rb

Constant Summary

Constants included from Glimmer

REGEX_METHODS_EXCLUDED

Instance Method Summary collapse

Methods included from NodeParentExpression

#add_content

Methods included from Glimmer

included, #method_missing

Methods included from ParentExpression

#add_content

Methods inherited from StaticExpression

inherited, keyword

Methods inherited from Expression

#add_content, dsl, #textual?, #widget?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer

Instance Method Details

#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/glimmer/dsl/xml/tag_expression.rb', line 14

def can_interpret?(parent, keyword, *args, &block)
  (parent == nil or parent.is_a?(Glimmer::XML::Node)) and
  (keyword.to_s == "tag") and
    args[0].include?(:_name)
end

#interpret(parent, keyword, *args, &block) ⇒ Object



20
21
22
23
24
25
# File 'lib/glimmer/dsl/xml/tag_expression.rb', line 20

def interpret(parent, keyword, *args, &block)
  attributes = args[0] if (args.size == 1)
  tag_name = attributes[:_name]
  attributes.delete(:_name)
  Glimmer::XML::Node.new(parent, tag_name, attributes, &block)
end