Sha256: 0a85c7cc5353c35012fa03d4d5f590f693f86245cd23780c2fc60712a27f97a2
Contents?: true
Size: 619 Bytes
Versions: 3
Compression:
Stored size: 619 Bytes
Contents
module Soroban # An enumerable that allows cells in a range to be visited. class Walker include Enumerable # Create a new walker from a supplied range and binding. The binding is # required when calculating the value of each visited cell. def initialize(range, binding) @binding = binding @fc, @fr, @tc, @tr = Soroban::getRange(range) end # Yield the value of each cell referenced by the supplied range. def each (@fc..@tc).each do |col| (@fr..@tr).each do |row| yield eval("@#{col}#{row}.get", @binding) end end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
soroban-0.1.1 | lib/soroban/walker.rb |
soroban-0.1.0 | lib/soroban/walker.rb |
Soroban-0.1.0 | lib/soroban/walker.rb |