module CsvExporter

Constants

VERSION

Public Class Methods

configuration() click to toggle source
# File lib/csv_exporter.rb, line 18
def configuration
  @configuration
end
file(filename = nil) click to toggle source
# File lib/csv_exporter.rb, line 22
def file(filename = nil)
  file_hash = if configuration
    { path: configuration['filepath'], name: filename || configuration['filename'] }
  else
    { path: 'tmp', name: filename || 'file.csv' }
  end

  File.join(root, file_hash[:path], file_hash[:name])
end
load(file, env = nil) click to toggle source
# File lib/csv_exporter.rb, line 12
def load(file, env = nil)
  @environment = env.to_s if env
  config = YAML.load_file(file)
  @configuration = defined?(@environment) ? config[@environment] : config
end
root() click to toggle source
# File lib/csv_exporter.rb, line 32
def root
  defined?(Rails) ? Rails.root : File.expand_path("../.." , __FILE__)
end