Sha256: 40ec36e5b64e8c3a5070ab9bd09d96d77138b3f8030c7af6aecfd92cbf3c907f

Contents?: true

Size: 1.14 KB

Versions: 15

Compression:

Stored size: 1.14 KB

Contents

require 'glimmer/dsl/static_expression'
require 'glimmer/dsl/top_level_expression'
require 'glimmer/xml/node'
require 'glimmer/xml/depth_first_search_iterator'
require 'glimmer/xml/name_space_visitor'

module Glimmer
  module DSL
    module XML
      class NameSpaceExpression < StaticExpression
        include TopLevelExpression

        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

        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
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
glimmer-dsl-xml-0.2.0 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-dsl-xml-0.1.0 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-dsl-css-0.1.0 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.8.2 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.8.1 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.8.0 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.7.8 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.7.7 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.7.6 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.7.5 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.7.4 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.7.3 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.7.2 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.7.1 lib/glimmer/dsl/xml/name_space_expression.rb
glimmer-0.7.0 lib/glimmer/dsl/xml/name_space_expression.rb