Class: Glimmer::DSL::XML::NameSpaceExpression

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

Instance Method Summary collapse

Instance Method Details

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



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/glimmer/dsl/xml/name_space_expression.rb', line 49

def add_content(parent, keyword, *args, &block)
  node = block.call(parent)
  unless node.is_a?(String)
    name_space_visitor = Glimmer::XML::NameSpaceVisitor.new(parent.name)
    Glimmer::XML::DepthFirstSearchIterator.new(node, name_space_visitor).iterate
#             def node.process_block(block)
#               Glimmer::Config.logger&.debug 'block'
#             end
  end
  parent.children << node if parent and !parent.children.include?(node)
  node
end

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

Returns:

  • (Boolean)


36
37
38
39
40
41
42
# File 'lib/glimmer/dsl/xml/name_space_expression.rb', line 36

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

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



44
45
46
47
# File 'lib/glimmer/dsl/xml/name_space_expression.rb', line 44

def interpret(parent, keyword, *args, &block)
  # act like a top-level xml tag
  Glimmer::XML::Node.new(parent, args[0].to_s, :_name_space_context => true)
end