Sha256: be1390862b52b287ed0537b0498067eda1ccbc3ed5dcefae3d49d701701e24ac
Contents?: true
Size: 1.05 KB
Versions: 6
Compression:
Stored size: 1.05 KB
Contents
module OpenStax module Accounts class ActionList def initialize(options={}) @options = options raise IllegalArgument, "must supply data procs" if options[:data_procs].nil? if options[:headings].present? && options[:data_procs].size != options[:headings].size raise IllegalArgument, "if you supply headings, you must supply one for each column" end if options[:widths].present? && options[:data_procs].size != options[:widths].size raise IllegalArgument, "if you supply widths, you must supply one for each column" end end def num_columns @options[:data_procs].size end def has_headings? @options[:headings].present? end def get_heading(column) @options[:headings].nil? ? nil : @options[:headings][column] end def get_width(column) @options[:widths].nil? ? nil : @options[:widths][column] end def get_data(column, *args) @options[:data_procs][column].call(*args) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems