Sha256: 1891406e73d3cb662d617dd125a5ca48764f76a3a24539ccce7f9b30ce7ddb35

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 Bytes

Contents

module Druid
  module Elements
    class UnOrderedList < Element

      def [](idx)
        Druid::Elements::ListItem.new(children[idx])
      end

      def items
        children.size
      end

      def each
        for index in 1..self.items do
          yield self[index-1]
        end
      end

      #
      # return the ListItem objects that are children of the
      # UnOrderedList
      #
      def list_items
        children.collect do |obj|
          Druid::Elements::ListItem.new(obj)
        end
      end

      protected

      def child_xpath
        "./child::li"
      end

      private

      def children
        element.uls(:xpath => child_xpath)
      end
    end

    Druid::Elements.tag_to_class[:ul] = Druid::Elements::UnOrderedList

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
druid-ts-1.2.4 lib/druid/elements/unordered_list.rb
druid-ts-1.2.3 lib/druid/elements/unordered_list.rb