Class: ActiveReport::Base
- Inherits:
-
Object
- Object
- ActiveReport::Base
- Defined in:
- lib/active_report/base.rb
Constant Summary collapse
- @@evaluate =
false
Class Method Summary collapse
- .evaluate(value = true) ⇒ Object
- .export(data, opts = {}) ⇒ Object
- .import(data, opts = {}) ⇒ Object
Instance Method Summary collapse
- #csv_force_encoding? ⇒ Boolean
- #csv_options ⇒ Object
- #import_adapter ⇒ Object
- #import_options ⇒ Object
-
#initialize(data, opts = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(data, opts = {}) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 |
# File 'lib/active_report/base.rb', line 7 def initialize(data, opts = {}) @data = data @opts = opts %i[except only].each { |key| @opts[key] = munge(@opts[key]) } { batch_size: 1_000, options: }.each { |key, val| @opts[key] ||= val } end |
Class Method Details
.evaluate(value = true) ⇒ Object
31 32 33 34 |
# File 'lib/active_report/base.rb', line 31 def self.evaluate(value = true) @@evaluate = value self end |
.export(data, opts = {}) ⇒ Object
36 37 38 39 |
# File 'lib/active_report/base.rb', line 36 def self.export(data, opts = {}) klass = new(data, opts) klass.export end |
.import(data, opts = {}) ⇒ Object
41 42 43 44 |
# File 'lib/active_report/base.rb', line 41 def self.import(data, opts = {}) klass = new(data, opts) klass.import end |
Instance Method Details
#csv_force_encoding? ⇒ Boolean
19 20 21 |
# File 'lib/active_report/base.rb', line 19 def csv_force_encoding? ActiveReport.configuration.csv_force_encoding end |
#csv_options ⇒ Object
15 16 17 |
# File 'lib/active_report/base.rb', line 15 def ActiveReport.configuration. end |
#import_adapter ⇒ Object
23 24 25 |
# File 'lib/active_report/base.rb', line 23 def import_adapter ActiveReport.configuration.import_adapter end |
#import_options ⇒ Object
27 28 29 |
# File 'lib/active_report/base.rb', line 27 def ActiveReport.configuration. end |