csv_exporter 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 422d00c24e6fffc4522bff8d68c82e9e1373dc07
4
- data.tar.gz: 7bffc4ed3ed1eec16f3fb5614938479b50895873
3
+ metadata.gz: e60930e70aab882351784baad242d6853a19c615
4
+ data.tar.gz: 179b1598b6892a722e7d50ad080b0a83ff22f654
5
5
  SHA512:
6
- metadata.gz: 05d8d4e87ca205d5c44d744c92146606af32344af676730da036d4068b271bf7f03f8c61c67f1cc711d5a222c0a6edb35285998c5e0cdf55e88f7329a4a7ad86
7
- data.tar.gz: 0e13d4a13ddfc235507cb7439bed77c34c5f86cef7f62680aba15512531eb7a1fa8ba6b050bc5c19ebe1b1d1f8a332f362088810f69743645e16c2d73afd98a4
6
+ metadata.gz: a302c31531a5ea7694ac122adde2f2a814fe95b00c4b79d2f73724ddd6dada5d6cb2d51f8ba66b684ecd73d3c3a371fc6d8f60829796e33a398c04422becb776
7
+ data.tar.gz: 2fd7003d43134eb780472561097f18ae9f3eab0f5bc5e53142221f4898ab22f7c949d04de8350cc124a77aa31ad7d2e7dcf582d9c03df30c1f293f08b2728e94
@@ -16,22 +16,17 @@ module CsvExporter
16
16
  end
17
17
 
18
18
  def configuration
19
- if defined? @environment
20
- raise RuntimeError.new("not configured CsvExporter for #{@environment} enviroment") unless @configuration
21
- else
22
- raise RuntimeError.new('not configured CsvExporter') unless @configuration
23
- end
24
-
25
19
  @configuration
26
20
  end
27
21
 
28
- def environment
29
- @environment
30
- end
31
-
32
22
  def file(filename = nil)
33
- filename ||= configuration['filename']
34
- File.join(root, configuration['filepath'], filename)
23
+ file_hash = if configuration
24
+ { path: configuration['filepath'], name: filename || configuration['filename'] }
25
+ else
26
+ { path: 'tmp', name: filename || 'file.csv' }
27
+ end
28
+
29
+ File.join(root, file_hash[:path], file_hash[:name])
35
30
  end
36
31
 
37
32
  def root
@@ -8,7 +8,7 @@ module CsvExporter
8
8
  CSV.open(CsvExporter.file(filename), 'w') do |csv|
9
9
 
10
10
  collection.each_with_index do |element, index|
11
- # binding.pry if index == 0
11
+
12
12
  case element.class.to_s.downcase
13
13
  when 'hash'
14
14
  csv << element.keys if index == 0
@@ -1,3 +1,3 @@
1
1
  module CsvExporter
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv_exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - DrawGun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-17 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: sqlite3
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rspec-rails
43
29
  requirement: !ruby/object:Gem::Requirement