class Soroban::LabelWalker
An enumerable that allows the labels for cells in a range to be visited.
Public Class Methods
new(range)
click to toggle source
Create a new walker from a supplied range.
# File lib/soroban/label_walker.rb, line 10 def initialize(range) @_fc, @_fr, @_tc, @_tr = Soroban::Helpers.getRange(range) end
Public Instance Methods
each() { |"#{col}#{row}"| ... }
click to toggle source
Yield the label of each cell referenced by the supplied range. For a range of the form “A1:B4”, this will yield “A1”, “A2”, “A3”, …, “B3”, “B4”.
# File lib/soroban/label_walker.rb, line 16 def each 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