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

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

Instance Method Summary collapse

Methods inherited from StaticExpression

inherited, keyword

Methods inherited from Expression

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

Instance Method Details

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

Returns:

  • (Boolean)


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

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



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/glimmer/dsl/xml/name_space_expression.rb', line 21

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