spreadsheet_exporter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +35 -1
- data/lib/spreadsheet_exporter.rb +5 -1
- data/lib/spreadsheet_exporter/spreadsheet.rb +1 -1
- data/lib/spreadsheet_exporter/version.rb +1 -1
- metadata +9 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d2eb209eee9ba1278a80d18bb76de88f1bc8853b
|
4
|
+
data.tar.gz: d28c4620775a149d83e52d8aaf34c93dd94f51f8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fb4ee13c8e3863d01000b93881710f3937bd91a0fc05886b1bcfe740891ecf11bf4bf334c207e914db9d1d00c38173d0dbfda4917c877535689c9fa1f9d84dbf
|
7
|
+
data.tar.gz: 77527fc2c06fc51e539ca1238cbed3263acc9c95077de58dd04fd84b4e51dbb9080bc8e6c626fdbc706aee0666fda96ea5b8784f8937eb619b9d0f534f0bf635
|
data/README.md
CHANGED
@@ -1,2 +1,36 @@
|
|
1
|
-
|
1
|
+
# SpreadsheetExporter
|
2
2
|
|
3
|
+
```ruby
|
4
|
+
gem 'spreadsheet_exporter'
|
5
|
+
```
|
6
|
+
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
Objects that are exported must respond to ```as_csv``` or ```as_json``` and return a hash
|
11
|
+
representing column names and values.
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
SpreadsheetExporter::Spreadsheet.from_objects(array_of_objects) do |row|
|
15
|
+
# Do some work on the row
|
16
|
+
end
|
17
|
+
|
18
|
+
# Starting at a custom offset
|
19
|
+
SpreadsheetImporter::Import.from_spreadsheet(spreadsheet, :start_row => 5) do |row|
|
20
|
+
```
|
21
|
+
|
22
|
+
### 2D Array
|
23
|
+
```ruby
|
24
|
+
SpreadsheetImporter::Import.from_spreadsheet([["Bob", "Hoskins"], ["Roger", "Rabbit"]])
|
25
|
+
```
|
26
|
+
|
27
|
+
### CSV
|
28
|
+
```ruby
|
29
|
+
SpreadsheetImporter::Import.from_csv("users.csv")
|
30
|
+
```
|
31
|
+
|
32
|
+
### .xlsx
|
33
|
+
```
|
34
|
+
SpreadsheetImporter::Import.from_xlsx("users.xlsx")
|
35
|
+
SpreadsheetImporter::Import.from_xlsx("users.xlsx", :sheet_name => '2015') # Processing a single sheet
|
36
|
+
```
|
data/lib/spreadsheet_exporter.rb
CHANGED
@@ -14,7 +14,7 @@ module SpreadsheetExporter
|
|
14
14
|
|
15
15
|
# Create the csv, ensuring to place each row's attributes under the appropriate header (since rows may not have all the same attributes)
|
16
16
|
[].tap do |spreadsheet|
|
17
|
-
spreadsheet << headers
|
17
|
+
spreadsheet << (options[:humanize_headers_class] ? han(options[:humanize_headers_class], headers) : headers)
|
18
18
|
rows.each do |row|
|
19
19
|
sorted_row = []
|
20
20
|
row.each do |header, value|
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet_exporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nicholas Jakobsen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-
|
11
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: write_xlsx
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -35,38 +32,37 @@ executables: []
|
|
35
32
|
extensions: []
|
36
33
|
extra_rdoc_files: []
|
37
34
|
files:
|
35
|
+
- MIT-LICENSE
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- lib/spreadsheet_exporter.rb
|
38
39
|
- lib/spreadsheet_exporter/csv.rb
|
39
40
|
- lib/spreadsheet_exporter/spreadsheet.rb
|
40
41
|
- lib/spreadsheet_exporter/version.rb
|
41
42
|
- lib/spreadsheet_exporter/xlsx.rb
|
42
|
-
- lib/spreadsheet_exporter.rb
|
43
43
|
- lib/tasks/exporter_tasks.rake
|
44
|
-
- MIT-LICENSE
|
45
|
-
- Rakefile
|
46
|
-
- README.md
|
47
44
|
homepage: https://github.com/culturecode/spreadsheet_exporter
|
48
45
|
licenses:
|
49
46
|
- MIT
|
47
|
+
metadata: {}
|
50
48
|
post_install_message:
|
51
49
|
rdoc_options: []
|
52
50
|
require_paths:
|
53
51
|
- lib
|
54
52
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
53
|
requirements:
|
57
54
|
- - ">="
|
58
55
|
- !ruby/object:Gem::Version
|
59
56
|
version: '0'
|
60
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
58
|
requirements:
|
63
59
|
- - ">="
|
64
60
|
- !ruby/object:Gem::Version
|
65
61
|
version: '0'
|
66
62
|
requirements: []
|
67
63
|
rubyforge_project:
|
68
|
-
rubygems_version:
|
64
|
+
rubygems_version: 2.4.7
|
69
65
|
signing_key:
|
70
|
-
specification_version:
|
66
|
+
specification_version: 4
|
71
67
|
summary: Export your data as various types of spreadsheets
|
72
68
|
test_files: []
|