Sha256: 293ec89b552c215b5cc5146f77b064dbd8eb6ce86f9769d59bd14406f125c129
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
module ExcelWalker module Writer class Hook attr_reader :max, :offset attr_accessor :style def initialize(condition) @matcher = case true when condition.is_a?(Range), condition.is_a?(Array) @max = condition.max proc { |row_num| condition.include?(row_num) } when condition.is_a?(Fixnum) @max = condition proc { |row_num| condition === row_num } else raise ArgumentException.new('Can only take Range, Integers or Arrays here') end @row_index = 0 end def match?(row_num) @matcher[row_num] end def after_column(offset) @offset = offset self end def fill(&block) @filler = block end def run(row_num) cells = Cells.new(style) @filler[cells, @row_index, row_num] cells.build @row_index += 1 cells end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
excel_walker-0.1.1 | lib/excel_walker/writer/hook.rb |
excel_walker-0.1.0 | lib/excel_walker/writer/hook.rb |
excel_walker-0.0.1 | lib/excel_walker/writer/hook.rb |