Class: Clio::Layout::List
- Inherits:
-
Clio::Layout
- Object
- Clio::Layout
- Clio::Layout::List
- Defined in:
- lib/clio/layout/list.rb
Overview
List of items.
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize(*items) ⇒ List
constructor
A new instance of List.
- #to_s ⇒ Object
Methods inherited from Clio::Layout
Constructor Details
#initialize(*items) ⇒ List
Returns a new instance of List.
12 13 14 15 16 17 |
# File 'lib/clio/layout/list.rb', line 12 def initialize(*items) = Hash===items.last ? items.pop : {} @items = items @mark = [:mark] end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
10 11 12 |
# File 'lib/clio/layout/list.rb', line 10 def items @items end |
Instance Method Details
#to_s ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/clio/layout/list.rb', line 19 def to_s s = [""] n = (items.size / 10).to_i + 1 items.each_with_index do |item, index| s << "%#{n}s. %s" % [index+1, item] end s << "" s.join("\n") end |