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

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

Instance Method Summary collapse

Methods included from NodeParentExpression

#add_content

Instance Method Details

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

Returns:

  • (Boolean)


35
36
37
38
39
# File 'lib/glimmer/dsl/xml/tag_expression.rb', line 35

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



41
42
43
44
45
46
# File 'lib/glimmer/dsl/xml/tag_expression.rb', line 41

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