Class: ActiveModel::ArrayExporter
- Inherits:
-
Object
- Object
- ActiveModel::ArrayExporter
- Defined in:
- lib/active_model/array_exporter.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#exporter ⇒ Object
readonly
Returns the value of attribute exporter.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(collection, options = {}) ⇒ ArrayExporter
constructor
A new instance of ArrayExporter.
- #to_csv ⇒ Object
- #to_xls ⇒ Object
Constructor Details
#initialize(collection, options = {}) ⇒ ArrayExporter
Returns a new instance of ArrayExporter.
7 8 9 10 11 |
# File 'lib/active_model/array_exporter.rb', line 7 def initialize(collection, = {}) @collection = Array(collection) @scope = .delete(:scope) @exporter = .delete(:exporter) end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
5 6 7 |
# File 'lib/active_model/array_exporter.rb', line 5 def collection @collection end |
#exporter ⇒ Object (readonly)
Returns the value of attribute exporter.
5 6 7 |
# File 'lib/active_model/array_exporter.rb', line 5 def exporter @exporter end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
5 6 7 |
# File 'lib/active_model/array_exporter.rb', line 5 def scope @scope end |
Instance Method Details
#to_csv ⇒ Object
13 14 15 |
# File 'lib/active_model/array_exporter.rb', line 13 def to_csv generate_file end |
#to_xls ⇒ Object
17 18 19 |
# File 'lib/active_model/array_exporter.rb', line 17 def to_xls generate_file(col_sep: "\t") end |