Sha256: ca5633c624f31561562c8154af10f3d649798d77920fa4d3bdff1baa0c9617d6

Contents?: true

Size: 540 Bytes

Versions: 10

Compression:

Stored size: 540 Bytes

Contents

module Weskit::WML
  class Elements < Items
    include Mixins::Container, Mixins::Searchable

    undef_method :attrs, :attributes
    undef_method :elems, :elements

    def [] key
      case key
        when Integer then contents[key]
        else contents[0][key] rescue nil
      end
    end

    def << item
      raise_unless Element, item
      item.amendment? ? append(item) : add(item)
      self
    end

    def find name, nested = true
      find_elements name, nested
    end

    alias_method :method_missing, :find
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
weskit-0.3.6 lib/weskit/wml/elements.rb
weskit-0.3.5 lib/weskit/wml/elements.rb
weskit-0.3.4 lib/weskit/wml/elements.rb
weskit-0.3.3 lib/weskit/wml/elements.rb
weskit-0.3.2 lib/weskit/wml/elements.rb
weskit-0.3.1 lib/weskit/wml/elements.rb
weskit-0.3.0 lib/weskit/wml/elements.rb
weskit-0.2.1 lib/weskit/wml/elements.rb
weskit-0.2.0 lib/weskit/wml/elements.rb
weskit-0.1.0 lib/weskit/wml/elements.rb