lib/soroban/label_walker.rb in soroban-0.2.0 vs lib/soroban/label_walker.rb in soroban-0.3.0
- old
+ new
@@ -10,12 +10,18 @@
@fc, @fr, @tc, @tr = Soroban::getRange(range)
end
# Yield the label of each cell referenced by the supplied range.
def each
- (@fc..@tc).each do |col|
- (@fr..@tr).each do |row|
- yield "#{col}#{row}"
+ col, row = @fc, @fr
+ while true do
+ yield "#{col}#{row}"
+ break if row == @tr && col == @tc
+ if row == @tr
+ row = @fr
+ col = col.next
+ else
+ row = row.next
end
end
end
end