Module: StairCar::Iteration
Instance Method Summary collapse
Instance Method Details
#each(&block) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/stair_car/shared/iteration.rb', line 3 def each(&block) rows.times do |row| cols.times do |col| yield(self.value_at(row,col)) end end end |
#each_column ⇒ Object
19 20 21 22 23 |
# File 'lib/stair_car/shared/iteration.rb', line 19 def each_column cols.times do |col_number| yield(self[nil,col_number],col_number) end end |
#each_row ⇒ Object
25 26 27 28 29 |
# File 'lib/stair_car/shared/iteration.rb', line 25 def each_row rows.times do |row_number| yield(self[row_number,nil],row_number) end end |
#each_with_index(&block) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/stair_car/shared/iteration.rb', line 11 def each_with_index(&block) rows.times do |row| cols.times do |col| yield(self.value_at(row,col), row, col) end end end |