Sha256: aab2db33e10e5e9c0503b1473ed5fb9a54052991f4e5a907051e8d144678f06e

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

require 'forwardable'

module Formic
  class ListItems < Base
    default_template 'formic/default/list_items'

    attr_reader :items
    extend Forwardable
    def_delegators :@items, :size, :push, :pop, :<<, :[], :shift, :unshift, :each, :length, :first, :last

    def _initialize list=[], options={}, &block
      super  &block
      @items = []

      list.each do |item|
        @items.push ListItem.new(self.page, item, options)
      end

      return self
    end

    def add_class class_name
      @items.each do |item|
        item.add_class class_name
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
formic-0.2.5 lib/formic/list_items.rb
formic-0.2.1 lib/formic/list_items.rb