Class: Katello::Util::ReportTable
- Inherits:
-
Object
- Object
- Katello::Util::ReportTable
- Defined in:
- app/lib/katello/util/report_table.rb
Instance Attribute Summary collapse
-
#column_hash ⇒ Object
Returns the value of attribute column_hash.
-
#column_names ⇒ Object
Returns the value of attribute column_names.
-
#data ⇒ Object
Returns the value of attribute data.
-
#renamed_columns ⇒ Object
Returns the value of attribute renamed_columns.
-
#transform ⇒ Object
Returns the value of attribute transform.
Instance Method Summary collapse
- #as(type) ⇒ Object
-
#initialize(params) ⇒ ReportTable
constructor
A new instance of ReportTable.
- #rename_column(original, new) ⇒ Object
Constructor Details
#initialize(params) ⇒ ReportTable
Returns a new instance of ReportTable.
8 9 10 11 12 13 14 15 |
# File 'app/lib/katello/util/report_table.rb', line 8 def initialize(params) self.transform = params[:transforms] self.column_names = params.fetch(:column_names, []) #retained for ordering self.data = params[:data] self.renamed_columns = {} self.column_hash = {} column_names.each { |name| column_hash[name] = {:name => name} } end |
Instance Attribute Details
#column_hash ⇒ Object
Returns the value of attribute column_hash.
6 7 8 |
# File 'app/lib/katello/util/report_table.rb', line 6 def column_hash @column_hash end |
#column_names ⇒ Object
Returns the value of attribute column_names.
6 7 8 |
# File 'app/lib/katello/util/report_table.rb', line 6 def column_names @column_names end |
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'app/lib/katello/util/report_table.rb', line 6 def data @data end |
#renamed_columns ⇒ Object
Returns the value of attribute renamed_columns.
6 7 8 |
# File 'app/lib/katello/util/report_table.rb', line 6 def renamed_columns @renamed_columns end |
#transform ⇒ Object
Returns the value of attribute transform.
6 7 8 |
# File 'app/lib/katello/util/report_table.rb', line 6 def transform @transform end |
Instance Method Details
#as(type) ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/lib/katello/util/report_table.rb', line 21 def as(type) if type == :csv as_csv(transform_data) elsif type == :text as_text(transform_data) end end |
#rename_column(original, new) ⇒ Object
17 18 19 |
# File 'app/lib/katello/util/report_table.rb', line 17 def rename_column(original, new) column_hash[original][:name] = new end |