Sha256: 5ec8fb98a099c1ce1e88bba476576d906aa53d8668529ffad0d8f0ee4ea04b7c

Contents?: true

Size: 600 Bytes

Versions: 4

Compression:

Stored size: 600 Bytes

Contents

module ExcelAbstraction
  class CellRange
    include Enumerable

    alias_method :first, :min
    alias_method :last, :max

    def initialize
      @cell_references = []
    end

    def each(&block)
      cell_references.each { |cell_reference| yield(cell_reference) }
    end

    def <<(attrs)
      cell_reference = ExcelAbstraction::CellReference.new(attrs)
      raise(ArgumentError, "Must be a CellReference belonging to the same row") if last && last.row != cell_reference.row
      self.cell_references << cell_reference
    end

    protected

    attr_reader :cell_references
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
excel_templating-0.4.2 lib/excel_templating/excel_abstraction/cell_range.rb
excel_templating-0.4.1 lib/excel_templating/excel_abstraction/cell_range.rb
excel_templating-0.4.0 lib/excel_templating/excel_abstraction/cell_range.rb
excel_templating-0.3.2 lib/excel_templating/excel_abstraction/cell_range.rb