Sha256: 613401b25e0dd11bc03068e9c46a802cda7519b345db8cb1b7c59881b14fa2b2

Contents?: true

Size: 891 Bytes

Versions: 23

Compression:

Stored size: 891 Bytes

Contents

module Hobo::Dryml::Parser

  class Element < REXML::Element

    def initialize(*args)
      super
      @elements = Hobo::Dryml::Parser::Elements.new(self)
    end

    def dryml_name
      expanded_name.sub(/:.*/, "")
    end

    attr_accessor :start_tag_source, :source_offset

    attr_writer :has_end_tag
    def has_end_tag?
      @has_end_tag
    end

    def parameter_tag?
      expanded_name =~ /:$/
    end

  end

  class Elements < REXML::Elements

    # Override to ensure DRYML elements are created
    def add(element=nil)
      rv = nil
      if element.nil?
        Hobo::Dryml::Parser::Element.new("", self, @element.context)
      elsif not element.kind_of?(Element)
        Hobo::Dryml::Parser::Element.new(element, self, @element.context)
      else
        @element << element
        element.context = @element.context
        element
      end
    end

  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
hobo-1.0.3 lib/hobo/dryml/parser/elements.rb
hobo-1.0.2 lib/hobo/dryml/parser/elements.rb
hobo-1.0.1 lib/hobo/dryml/parser/elements.rb
hobo-1.0.0 lib/hobo/dryml/parser/elements.rb
hobo-0.9.106 lib/hobo/dryml/parser/elements.rb
hobo-0.9.105 lib/hobo/dryml/parser/elements.rb
hobo-0.9.104 lib/hobo/dryml/parser/elements.rb
hobo-0.9.103 lib/hobo/dryml/parser/elements.rb
hobo-0.9.102 lib/hobo/dryml/parser/elements.rb
hobo-0.9.101 lib/hobo/dryml/parser/elements.rb
hobo-0.9.100 lib/hobo/dryml/parser/elements.rb
hobo-0.9.0 lib/hobo/dryml/parser/elements.rb
hobo-0.8.10 lib/hobo/dryml/parser/elements.rb
hobo-0.8.9 lib/hobo/dryml/parser/elements.rb
hobo-0.8.8 lib/hobo/dryml/parser/elements.rb
hobo-0.8.2 lib/hobo/dryml/parser/elements.rb
hobo-0.8.1 lib/hobo/dryml/parser/elements.rb
hobo-0.8.3 lib/hobo/dryml/parser/elements.rb
hobo-0.8.4 lib/hobo/dryml/parser/elements.rb
hobo-0.8.5 lib/hobo/dryml/parser/elements.rb