Sha256: 83a635b8f68b06125c97cfa9224ec420ed0424c608b51b4dd9f7f9e9548de920

Contents?: true

Size: 867 Bytes

Versions: 16

Compression:

Stored size: 867 Bytes

Contents

require 'glimmer/dsl/xml/node_parent_expression'
require 'glimmer/dsl/xml/xml_expression'
require 'glimmer/dsl/static_expression'
require 'glimmer/dsl/top_level_expression'
require 'glimmer/xml/node'

module Glimmer
  module DSL
    module XML
      class TagExpression < StaticExpression
        include TopLevelExpression
        include NodeParentExpression

        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

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

Version data entries

16 entries across 16 versions & 3 rubygems

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