Module: Rapport::Report::ClassMethods

Defined in:
lib/rapport/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#row_dataObject

Returns the value of attribute row_data.



16
17
18
# File 'lib/rapport/report.rb', line 16

def row_data
  @row_data
end

Instance Method Details

#column(*args, &block) ⇒ Object

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rapport/report.rb', line 18

def column(*args, &block)
  raise ArgumentError.new("wrong number of arguments (#{args.length} for 1,2, or 3)") unless args.length >= 1 and args.length <= 3
  header = args[0]
  if args.length == 3
    symbol = args[1].to_sym; options = args[2].to_hash
  elsif args.length == 2
    if args[1].is_a?(Symbol)
      symbol = args[1]; options = {}
    else
      symbol = Rapport.format_underscore(header.downcase).to_sym; options = args[1].to_hash
    end
  end
  add_calculator(symbol, options) unless options.nil?
  instance_variable_get(:@columns) << [header, symbol]
end