Class: Tiqbi::View::Collection
- Inherits:
-
Object
- Object
- Tiqbi::View::Collection
- Defined in:
- lib/tiqbi/view/collection.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
Returns the value of attribute collection.
Instance Method Summary collapse
- #all ⇒ Object
- #at(index) {|line| ... } ⇒ Object
- #clear ⇒ Object
-
#initialize(collection = []) ⇒ Collection
constructor
A new instance of Collection.
- #insert(index, value) ⇒ Object
- #line_size ⇒ Object
- #push(value) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(collection = []) ⇒ Collection
Returns a new instance of Collection.
7 8 9 |
# File 'lib/tiqbi/view/collection.rb', line 7 def initialize(collection = []) @collection = collection end |
Instance Attribute Details
#collection ⇒ Object
Returns the value of attribute collection.
6 7 8 |
# File 'lib/tiqbi/view/collection.rb', line 6 def collection @collection end |
Instance Method Details
#all ⇒ Object
18 19 20 |
# File 'lib/tiqbi/view/collection.rb', line 18 def all @collection end |
#at(index) {|line| ... } ⇒ Object
10 11 12 13 14 |
# File 'lib/tiqbi/view/collection.rb', line 10 def at(index, &block) line = @collection[index] return line unless block_given? yield line end |
#clear ⇒ Object
30 31 32 |
# File 'lib/tiqbi/view/collection.rb', line 30 def clear @collection = [] end |
#insert(index, value) ⇒ Object
24 25 26 |
# File 'lib/tiqbi/view/collection.rb', line 24 def insert(index, value) @collection.insert(index, value) end |
#line_size ⇒ Object
27 28 29 |
# File 'lib/tiqbi/view/collection.rb', line 27 def line_size @collection.size end |
#push(value) ⇒ Object
15 16 17 |
# File 'lib/tiqbi/view/collection.rb', line 15 def push(value) @collection << value end |
#size ⇒ Object
21 22 23 |
# File 'lib/tiqbi/view/collection.rb', line 21 def size @collection.size end |