Module: CsvCreator

Defined in:
lib/csv_creator.rb,
lib/csv_creator/creator.rb,
lib/csv_creator/version.rb

Defined Under Namespace

Classes: Creator

Constant Summary collapse

VERSION =
'0.9.3'

Class Method Summary collapse

Class Method Details

.create(collection, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/csv_creator.rb', line 6

def self.create(collection, options = {})
  options_with_defaults = options.reverse_merge({
      csv: { force_quotes: true, headers: true },
      only: nil,
      without: nil,
      order: [],
      order_direction: :asc,
      translate: {},
      callbacks: {}
    })

  Creator.new(collection, options_with_defaults).generate_csv(options_with_defaults)
end

.generate(collection, options = {}) ⇒ Object

Alias



21
22
23
# File 'lib/csv_creator.rb', line 21

def self.generate(collection, options = {})
  create(collection, options)
end