Sha256: eb5eaa0eae854b9678d91c4f6529c720a6073b8612ff666d1ab999faaeba5bb3

Contents?: true

Size: 478 Bytes

Versions: 1

Compression:

Stored size: 478 Bytes

Contents

module Soroban

  # An enumerable that allows cells in a range to be visited.
  class LabelWalker

    include Enumerable

    # Create a new walker from a supplied range.
    def initialize(range)
      @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}"
        end
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
soroban-0.2.0 lib/soroban/label_walker.rb