Sha256: b7353ac18e732f385532af6999a1f7b943f37020dee868ae8e37004133c33f35
Contents?: true
Size: 994 Bytes
Versions: 4
Compression:
Stored size: 994 Bytes
Contents
module Rubyxls class ViewModel attr_reader :data_rows def initialize(**opts) @data_rows = [] @data_rows_count = opts.fetch(:rows_count, nil) build_title_row! build_header_row! build_data_rows! build_additional_rows! unless @data_rows_count.nil? build_total_row! end private def build_title_row! [] end def build_header_row! [] end def build_data_rows! [] end def build_additional_row! [] end def build_total_row! [] end def build_additional_rows! until @data_rows.size == @data_rows_count do build_additional_row! end end def add_empty_cell(*style) { value: nil, style: style } end def limit_data_to_data_rows_count(data) @data_rows_count.nil? ? data : data[0...calculate_data_rows_remaining] end def calculate_data_rows_remaining @data_rows_count - @data_rows.size end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rubyxls-1.0.3 | lib/rubyxls/view_model.rb |
rubyxls-1.0.2 | lib/rubyxls/view_model.rb |
rubyxls-1.0.1 | lib/rubyxls/view_model.rb |
rubyxls-1.0.0 | lib/rubyxls/view_model.rb |