Class: Formic::ListItems

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/formic/list_items.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#content, #options, #page, #template

Instance Method Summary collapse

Methods inherited from Base

default_template, #formics, #has_class?, #initialize, #merge_options, #method_missing, template, #to_s

Constructor Details

This class inherits a constructor from Formic::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Formic::Base

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



7
8
9
# File 'lib/formic/list_items.rb', line 7

def items
  @items
end

Instance Method Details

#_initialize(list = [], options = {}, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/formic/list_items.rb', line 11

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

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

  return self
end

#add_class(class_name) ⇒ Object



22
23
24
25
26
# File 'lib/formic/list_items.rb', line 22

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