module Spout::Models::Tables
Constants
- DEFAULT_CLASS
- GRAPHABLE_CLASSES
Public Class Methods
for(variable, chart_variable, subjects, subtitle, totals: true)
click to toggle source
# File lib/spout/models/tables.rb, line 20 def self.for(variable, chart_variable, subjects, subtitle, totals: true) table_type = get_table_type(variable, chart_variable) (GRAPHABLE_CLASSES[table_type] || DEFAULT_CLASS).new(variable, chart_variable, subjects, subtitle, totals) end
get_table_type(variable, chart_variable)
click to toggle source
# File lib/spout/models/tables.rb, line 25 def self.get_table_type(variable, chart_variable) "#{variable_to_table_type(variable)}_vs_#{variable_to_table_type(chart_variable)}" end
variable_to_table_type(variable)
click to toggle source
Identical to graphables, TODO: Refactor
# File lib/spout/models/tables.rb, line 30 def self.variable_to_table_type(variable) variable_type = (variable ? variable.type : nil) case variable_type when "numeric", "integer" "numeric" else variable_type end end