Class: ActiveMetric::ReportViewModel::TableViewModel

Inherits:
Object
  • Object
show all
Defined in:
lib/active_metric/report_view_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, table_data, options) ⇒ TableViewModel

Returns a new instance of TableViewModel.



68
69
70
71
72
73
74
75
# File 'lib/active_metric/report_view_model.rb', line 68

def initialize(template, table_data, options)
  @title = options[:title]
  @rows = []
  @headers = template.headers
  table_data.each do |row_data|
    @rows << RowViewModel.new(row_data, template.columns)
  end
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



66
67
68
# File 'lib/active_metric/report_view_model.rb', line 66

def headers
  @headers
end

#rowsObject (readonly)

Returns the value of attribute rows.



65
66
67
# File 'lib/active_metric/report_view_model.rb', line 65

def rows
  @rows
end

#titleObject (readonly)

Returns the value of attribute title.



64
65
66
# File 'lib/active_metric/report_view_model.rb', line 64

def title
  @title
end