roo 2.0.1 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +17 -0
  3. data/.github/ISSUE_TEMPLATE +10 -0
  4. data/.gitignore +4 -0
  5. data/.travis.yml +10 -6
  6. data/CHANGELOG.md +116 -1
  7. data/Gemfile +3 -4
  8. data/Gemfile_ruby2 +30 -0
  9. data/Guardfile +1 -2
  10. data/README.md +56 -22
  11. data/Rakefile +1 -1
  12. data/lib/roo/base.rb +108 -245
  13. data/lib/roo/constants.rb +5 -0
  14. data/lib/roo/csv.rb +94 -87
  15. data/lib/roo/errors.rb +11 -0
  16. data/lib/roo/excelx/cell/base.rb +94 -0
  17. data/lib/roo/excelx/cell/boolean.rb +27 -0
  18. data/lib/roo/excelx/cell/date.rb +28 -0
  19. data/lib/roo/excelx/cell/datetime.rb +111 -0
  20. data/lib/roo/excelx/cell/empty.rb +19 -0
  21. data/lib/roo/excelx/cell/number.rb +87 -0
  22. data/lib/roo/excelx/cell/string.rb +19 -0
  23. data/lib/roo/excelx/cell/time.rb +43 -0
  24. data/lib/roo/excelx/cell.rb +33 -4
  25. data/lib/roo/excelx/comments.rb +33 -0
  26. data/lib/roo/excelx/coordinate.rb +12 -0
  27. data/lib/roo/excelx/extractor.rb +3 -4
  28. data/lib/roo/excelx/format.rb +64 -0
  29. data/lib/roo/excelx/shared.rb +32 -0
  30. data/lib/roo/excelx/shared_strings.rb +124 -4
  31. data/lib/roo/excelx/sheet.rb +12 -7
  32. data/lib/roo/excelx/sheet_doc.rb +108 -97
  33. data/lib/roo/excelx/styles.rb +1 -1
  34. data/lib/roo/excelx.rb +61 -103
  35. data/lib/roo/formatters/base.rb +15 -0
  36. data/lib/roo/formatters/csv.rb +84 -0
  37. data/lib/roo/formatters/matrix.rb +23 -0
  38. data/lib/roo/formatters/xml.rb +31 -0
  39. data/lib/roo/formatters/yaml.rb +40 -0
  40. data/lib/roo/libre_office.rb +1 -2
  41. data/lib/roo/link.rb +21 -2
  42. data/lib/roo/open_office.rb +468 -523
  43. data/lib/roo/spreadsheet.rb +3 -1
  44. data/lib/roo/tempdir.rb +21 -0
  45. data/lib/roo/utils.rb +7 -7
  46. data/lib/roo/version.rb +1 -1
  47. data/lib/roo.rb +8 -3
  48. data/roo.gemspec +2 -1
  49. data/spec/helpers.rb +5 -0
  50. data/spec/lib/roo/base_spec.rb +229 -0
  51. data/spec/lib/roo/csv_spec.rb +19 -0
  52. data/spec/lib/roo/excelx_spec.rb +97 -11
  53. data/spec/lib/roo/openoffice_spec.rb +18 -1
  54. data/spec/lib/roo/spreadsheet_spec.rb +20 -0
  55. data/spec/lib/roo/utils_spec.rb +1 -1
  56. data/spec/spec_helper.rb +5 -5
  57. data/test/all_ss.rb +12 -11
  58. data/test/excelx/cell/test_base.rb +63 -0
  59. data/test/excelx/cell/test_boolean.rb +36 -0
  60. data/test/excelx/cell/test_date.rb +38 -0
  61. data/test/excelx/cell/test_datetime.rb +45 -0
  62. data/test/excelx/cell/test_empty.rb +7 -0
  63. data/test/excelx/cell/test_number.rb +74 -0
  64. data/test/excelx/cell/test_string.rb +28 -0
  65. data/test/excelx/cell/test_time.rb +30 -0
  66. data/test/formatters/test_csv.rb +119 -0
  67. data/test/formatters/test_matrix.rb +76 -0
  68. data/test/formatters/test_xml.rb +78 -0
  69. data/test/formatters/test_yaml.rb +20 -0
  70. data/test/helpers/test_accessing_files.rb +60 -0
  71. data/test/helpers/test_comments.rb +43 -0
  72. data/test/helpers/test_formulas.rb +9 -0
  73. data/test/helpers/test_labels.rb +103 -0
  74. data/test/helpers/test_sheets.rb +55 -0
  75. data/test/helpers/test_styles.rb +62 -0
  76. data/test/roo/test_base.rb +182 -0
  77. data/test/roo/test_csv.rb +60 -0
  78. data/test/roo/test_excelx.rb +325 -0
  79. data/test/roo/test_libre_office.rb +9 -0
  80. data/test/roo/test_open_office.rb +289 -0
  81. data/test/test_helper.rb +116 -18
  82. data/test/test_roo.rb +362 -2088
  83. metadata +70 -4
  84. data/test/test_generic_spreadsheet.rb +0 -237
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db86b4586034783940303cfd17a7ee5c60277a51
4
- data.tar.gz: 2cf9222f2f2759f164164f745c72abe6b901df98
3
+ metadata.gz: 711650fb2132509af1a6df5cd4b5a3d83eaac68f
4
+ data.tar.gz: ca23282af485cfa63d4b4a761d4081841edd385c
5
5
  SHA512:
6
- metadata.gz: 442e05a8bffdc839c45a8684e8882f4327098387617b76027b6b5c0543c2a7b4be284c511c35f8333c9bc1147e31350d1f6f67174fc62e5b7fc45520ab0ad307
7
- data.tar.gz: 4ba67602e5772cae52f41ea0357ddd6835d25c35be57797307a6194a46ad977d7922b884b4fa826c91efd8533c6f3e56995e8cb0a13146a32e4a3ee7d5e42ae9
6
+ metadata.gz: 7166103bc551a008905e6052369ed5cf714bd949d83021e3596cef8ae083fccead0faac1b28591bf28b09f977202955c4f2e92fda45a5961475eff4ea3caa93e
7
+ data.tar.gz: dc030d1d1530114289e8a420283fdf3131759ee107dfaa17bcc35c098e5d0e8b74fe984dc655b72a2701b211e3af3442f3cd79f0ad07e9cf1e7587496cfc7a16
data/.codeclimate.yml ADDED
@@ -0,0 +1,17 @@
1
+ ---
2
+ engines:
3
+ duplication:
4
+ enabled: true
5
+ config:
6
+ languages:
7
+ - ruby
8
+ fixme:
9
+ enabled: true
10
+ rubocop:
11
+ enabled: true
12
+ ratings:
13
+ paths:
14
+ - "**.rb"
15
+ exclude_paths:
16
+ - spec/
17
+ - test/
@@ -0,0 +1,10 @@
1
+ Thanks for filing an issue. Following these instructions will help us solve your problem sooner.
2
+
3
+ 1. Describe the issue.
4
+ 2. Create a gist for this issue (Sample gist: https://gist.github.com/stevendaniels/98a05849036e99bb8b3c)?
5
+
6
+ Here are some instructions for creating such a gist.
7
+
8
+ 1. Create a gist (https://gist.github.com) with code that creates the error.
9
+ 2. Clone the gist repo locally, add a stripped down version of the offending spreadsheet to the gist repo, and push the gist's changes master.
10
+ 3. Paste the gist url here.
data/.gitignore CHANGED
@@ -5,3 +5,7 @@
5
5
  .project
6
6
  *.lock
7
7
  .idea
8
+ .buildpath
9
+ *~
10
+ .bundle/
11
+ lbin/
data/.travis.yml CHANGED
@@ -1,13 +1,17 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1
5
- - 2.2.0
3
+ - 2.2.4
4
+ - 2.3.1
5
+ - 2.4.0
6
6
  - ruby-head
7
- - jruby-19mode # JRuby in 1.9 mode
8
- - rbx-2
7
+ - jruby-9.1.6.0
9
8
  matrix:
9
+ include:
10
+ - rvm: 2.0.0
11
+ gemfile: Gemfile_ruby2
12
+ - rvm: 2.1.8
13
+ gemfile: Gemfile_ruby2
10
14
  allow_failures:
11
15
  - rvm: ruby-head
12
- - rvm: jruby-19mode
16
+ - rvm: jruby-9.1.6.0
13
17
  bundler_args: --without local_development
data/CHANGELOG.md CHANGED
@@ -1,3 +1,118 @@
1
+ ## Unreleased
2
+
3
+ ## [2.7.1] 2017-01-03
4
+ ### Fixed
5
+ - Fixed regression where a CSV's encoding was being ignored [372](https://github.com/roo-rb/roo/pull/372)
6
+
7
+ ## [2.7.0] 2016-12-31
8
+ ### Fixed
9
+ - Added rack server for testing Roo's download capabilities [365](https://github.com/roo-rb/roo/pull/365)
10
+ - Refactored tests into different formats [365](https://github.com/roo-rb/roo/pull/365)
11
+ - Fixed OpenOffice for JRuby [362](https://github.com/roo-rb/roo/pull/362)
12
+ - Added '0.000000' => '%.6f' number format [354](https://github.com/roo-rb/roo/pull/354)
13
+ - Add additional formula cell types for to_csv [367][https://github.com/roo-rb/roo/pull/367]
14
+
15
+ ### Added
16
+ - Extracted formatters from Roo::Base#to_* methods [364](https://github.com/roo-rb/roo/pull/364)
17
+
18
+ ## [2.6.0] 2016-12-28
19
+ ### Fixed
20
+ - Fixed error if sheet name starts with a slash [348](https://github.com/roo-rb/roo/pull/348)
21
+ - Fixed loading to support files on ftp [355](https://github.com/roo-rb/roo/pull/355)
22
+ - Fixed Ruby 2.4.0 deprecation warnings [356](https://github.com/roo-rb/roo/pull/356)
23
+ - properly return date as string [359](https://github.com/roo-rb/roo/pull/359)
24
+
25
+ ### Added
26
+ - Cell values can be set in a CSV [350](https://github.com/roo-rb/roo/pull/350/)
27
+ - Raise an error Roo::Excelx::Extractor document is missing [358](https://github.com/roo-rb/roo/pull/358/)
28
+
29
+ ## [2.5.1] 2016-08-26
30
+ ### Fixed
31
+ - Fixed NameError. [337](https://github.com/roo-rb/roo/pull/337)
32
+
33
+ ## [2.5.0] 2016-08-21
34
+ ### Fixed
35
+ - Remove temporary directories via finalizers on garbage collection. This cleans them up in all known cases, rather than just when the #close method is called. The #close method can be used to cleanup early. [329](https://github.com/roo-rb/roo/pull/329)
36
+ - Fixed README.md typo [318](https://github.com/roo-rb/roo/pull/318)
37
+ - Parse sheets in ODS files once to improve performance [320](https://github.com/roo-rb/roo/pull/320)
38
+ - Fix some Cell conversion issues [324](https://github.com/roo-rb/roo/pull/324) and [331](https://github.com/roo-rb/roo/pull/331)
39
+ - Improved memory performance [332](https://github.com/roo-rb/roo/pull/332)
40
+ - Added `no_hyperlinks` option to improve streamig performance [319](https://github.com/roo-rb/roo/pull/319) and [333](https://github.com/roo-rb/roo/pull/333)
41
+
42
+ ### Deprecations
43
+ - Roo::Base::TEMP_PREFIX should be accessed via Roo::TEMP_PREFIX
44
+ - The private Roo::Base#make_tempdir is now available at the class level in
45
+ classes that use temporary directories, added via Roo::Tempdir
46
+ =======
47
+ ### Added
48
+ - Discard hyperlinks lookups to allow streaming parsing without loading whole files
49
+
50
+ ## [2.4.0] 2016-05-14
51
+ ### Fixed
52
+ - Fixed opening spreadsheets with charts [315](https://github.com/roo-rb/roo/pull/315)
53
+ - Fixed memory issues for Roo::Utils.number_to_letter [308](https://github.com/roo-rb/roo/pull/308)
54
+ - Fixed Roo::Excelx::Cell::Number to recognize floating point numbers [306](https://github.com/roo-rb/roo/pull/306)
55
+ - Fixed version number in Readme.md [304](https://github.com/roo-rb/roo/pull/304)
56
+
57
+ ### Added
58
+ - Added initial support for HTML formatting [278](https://github.com/roo-rb/roo/pull/278)
59
+
60
+ ## [2.3.2] 2016-02-18
61
+ ### Fixed
62
+ - Handle url with long query params (ex. S3 secure url) [302](https://github.com/roo-rb/roo/pull/302)
63
+ - Allow streaming for Roo::CSV [297](https://github.com/roo-rb/roo/pull/297)
64
+ - Export Fixnums to Added csv [295](https://github.com/roo-rb/roo/pull/295)
65
+ - Removed various Ruby warnings [289](https://github.com/roo-rb/roo/pull/289)
66
+ - Fix incorrect example result in Readme.md [293](https://github.com/roo-rb/roo/pull/293)
67
+
68
+ ## [2.3.1] - 2016-01-08
69
+ ### Fixed
70
+ - Properly parse scientific-notation number like 1E-3 [#288](https://github.com/roo-rb/roo/pull/288)
71
+ - Include all tests in default rake run [#283](https://github.com/roo-rb/roo/pull/283)
72
+ - Fix zero-padded numbers for Excelx [#282](https://github.com/roo-rb/roo/pull/282)
73
+
74
+ ### Changed
75
+ - Moved `ERROR_VALUES` from Excelx::Cell::Number ~> Excelx. [#280](https://github.com/roo-rb/roo/pull/280)
76
+
77
+ ## [2.3.0] - 2015-12-10
78
+ ### Changed
79
+ - Excelx::Cell::Number will return a String instead of an Integer or Float if the cell has an error like #DIV/0, etc. [#273](https://github.com/roo-rb/roo/pull/273)
80
+
81
+ ### Fixed
82
+ - Excelx::Cell::Number now handles cell errors. [#273](https://github.com/roo-rb/roo/pull/273)
83
+
84
+ ## [2.2.0] - 2015-10-31
85
+ ### Added
86
+ - Added support for returning Integers values to Roo::OpenOffice [#258](https://github.com/roo-rb/roo/pull/258)
87
+ - A missing Header Raises `Roo::HeaderRowNotFoundError` [#247](https://github.com/roo-rb/roo/pull/247)
88
+ - Roo::Excelx::Shared class to pass shared data to Roo::Excelx sheets [#220](https://github.com/roo-rb/roo/pull/220)
89
+ - Proper Type support to Roo::Excelx [#240](https://github.com/roo-rb/roo/pull/240)
90
+ - Added Roo::HeaderRowNotFoundError [#247](https://github.com/roo-rb/roo/pull/247)
91
+
92
+ ### Changed
93
+ - Made spelling/grammar corrections in the README[260](https://github.com/roo-rb/roo/pull/260)
94
+ - Moved Roo::Excelx::Format module [#259](https://github.com/roo-rb/roo/pull/259)
95
+ - Updated README with details about `Roo::Excelx#each_with_streaming` method [#250](https://github.com/roo-rb/roo/pull/250)
96
+
97
+ ### Fixed
98
+ - Fixed Base64 not found issue in Open Office [#267](https://github.com/roo-rb/roo/pull/267)
99
+ - Fixed Regexp to allow method access to cells with multiple digits [#255](https://github.com/roo-rb/roo/pull/255), [#268](https://github.com/roo-rb/roo/pull/268)
100
+
101
+ ## [2.1.1] - 2015-08-02
102
+ ### Fixed invalid new lines with _x000D_ character[#231](https://github.com/roo-rb/roo/pull/231)
103
+ ### Fixed missing URI issue. [#245](https://github.com/roo-rb/roo/pull/245)
104
+
105
+ ## [2.1.0] - 2015-07-18
106
+ ### Added
107
+ - Added support for Excel 2007 `xlsm` files. [#232](https://github.com/roo-rb/roo/pull/232)
108
+ - Roo::Excelx returns an enumerator when calling each_row_streaming without a block. [#224](https://github.com/roo-rb/roo/pull/224)
109
+ - Returns an enumerator when calling `each` without a block. [#219](https://github.com/roo-rb/roo/pull/219)
110
+
111
+ ### Fixed
112
+ - Removed tabs and windows CRLF. [#235](https://github.com/roo-rb/roo/pull/235), [#234](https://github.com/roo-rb/roo/pull/234)
113
+ - Fixed Regexp to only check for valid URI's when opening a spreadsheet. [#229](https://github.com/roo-rb/roo/pull/228)
114
+ - Open streams in Roo:Excelx correctly. [#222](https://github.com/roo-rb/roo/pull/222)
115
+
1
116
  ## [2.0.1] - 2015-06-01
2
117
  ### Added
3
118
  - Return an enumerator when calling '#each' without a block [#219](https://github.com/roo-rb/roo/pull/219)
@@ -464,7 +579,7 @@
464
579
 
465
580
  ## [0.2.4] - 2007-06-16
466
581
  ### Fixed
467
- - ID 11605 Two cols with same value: crash roo (openoffice version only)
582
+ - ID 11605 Two cols with same value: crash roo (openoffice version only)
468
583
 
469
584
  ## [0.2.3] - 2007-06-02
470
585
  ### Changed / Added
data/Gemfile CHANGED
@@ -4,12 +4,12 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  # additional testing libs
7
- gem 'webmock'
8
7
  gem 'shoulda'
8
+ gem 'activesupport', '< 5.1'
9
9
  gem 'rspec', '>= 3.0.0'
10
- gem 'vcr'
11
10
  gem 'simplecov', '>= 0.9.0', require: false
12
11
  gem 'coveralls', require: false
12
+ gem "minitest-reporters"
13
13
  end
14
14
 
15
15
  group :local_development do
@@ -17,8 +17,7 @@ group :local_development do
17
17
  gem 'guard-rspec', '>= 4.3.1', require: false
18
18
  gem 'guard-minitest', require: false
19
19
  gem 'guard-bundler', require: false
20
- gem 'guard-preek', require: false
21
20
  gem 'guard-rubocop', require: false
22
- gem 'guard-reek', github: 'pericles/guard-reek', require: false
21
+ gem "rb-readline"
23
22
  gem 'pry'
24
23
  end
data/Gemfile_ruby2 ADDED
@@ -0,0 +1,30 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'nokogiri', "< 1.7.0"
6
+
7
+ group :test do
8
+ # additional testing libs
9
+ gem 'shoulda'
10
+ gem 'rspec', '>= 3.0.0'
11
+ gem 'simplecov', '>= 0.9.0', require: false
12
+ gem 'coveralls', require: false
13
+ gem "activesupport", "~> 4.2.0"
14
+ gem "tins", '~> 1.6.0'
15
+ gem "term-ansicolor", "~> 1.3.2"
16
+ gem "minitest-reporters"
17
+ end
18
+
19
+ group :local_development do
20
+ gem "listen", "~> 3.0.6"
21
+ gem 'terminal-notifier-guard', require: false if RUBY_PLATFORM.downcase.include?('darwin')
22
+ gem 'guard-rspec', '>= 4.3.1', require: false
23
+ gem 'guard-minitest', require: false
24
+ gem 'guard-bundler', require: false
25
+ gem 'guard-preek', require: false
26
+ gem 'guard-rubocop', require: false
27
+ gem 'guard-reek', github: 'pericles/guard-reek', require: false
28
+ gem 'rb-readline'
29
+ gem 'pry'
30
+ end
data/Guardfile CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  guard :minitest, test_folders: ['test'] do
5
5
  watch(%r{^test/(.*)\/?test_(.*)\.rb$})
6
- watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
6
+ watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1].to_s.sub('roo/', '')}test_#{m[2]}.rb" }
7
7
  watch(%r{^test/test_helper\.rb$}) { 'test' }
8
8
  end
9
9
 
@@ -21,4 +21,3 @@ guard :rspec, cmd: 'bundle exec rspec' do
21
21
  watch('spec/spec_helper.rb') { "spec" }
22
22
  watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
23
23
  end
24
-
data/README.md CHANGED
@@ -3,16 +3,13 @@
3
3
  [![Build Status](https://img.shields.io/travis/roo-rb/roo.svg?style=flat-square)](https://travis-ci.org/roo-rb/roo) [![Code Climate](https://img.shields.io/codeclimate/github/roo-rb/roo.svg?style=flat-square)](https://codeclimate.com/github/roo-rb/roo) [![Coverage Status](https://img.shields.io/coveralls/roo-rb/roo.svg?style=flat-square)](https://coveralls.io/r/roo-rb/roo) [![Gem Version](https://img.shields.io/gem/v/roo.svg?style=flat-square)](https://rubygems.org/gems/roo)
4
4
 
5
5
  Roo implements read access for all common spreadsheet types. It can handle:
6
-
7
- * Excelx
8
- * OpenOffice / LibreOffice
6
+ * Excel 2007 - 2013 formats (xlsx, xlsm)
7
+ * LibreOffice / OpenOffice.org formats (ods)
9
8
  * CSV
9
+ * Excel 97, Excel 2002 XML, and Excel 2003 XML formats when using the [roo-xls](https://github.com/roo-rb/roo-xls) gem (xls, xml)
10
+ * Google spreadsheets with read/write access when using [roo-google](https://github.com/roo-rb/roo-google)
10
11
 
11
- ## Additional Libraries
12
-
13
- In addition, the [roo-xls](https://github.com/roo-rb/roo-xls) and [roo-google](https://github.com/roo-rb/roo-google) gems exist to extend Roo to support reading classic Excel formats (i.e. `.xls` and ``Excel2003XML``) and read/write access for Google spreadsheets.
14
-
15
- # #Installation
12
+ ## Installation
16
13
 
17
14
  Install as a gem
18
15
 
@@ -21,7 +18,7 @@ Install as a gem
21
18
  Or add it to your Gemfile
22
19
 
23
20
  ```ruby
24
- gem 'roo', '~> 2.0.0'
21
+ gem "roo", "~> 2.7.0"
25
22
  ```
26
23
  ## Usage
27
24
 
@@ -53,7 +50,7 @@ ods.sheet(0).row(1)
53
50
 
54
51
  # Set the last sheet as the default sheet.
55
52
  ods.default_sheet = ods.sheets.last
56
- ods.default_sheet = s.sheets[3]
53
+ ods.default_sheet = ods.sheets[2]
57
54
  ods.default_sheet = 'Sheet 3'
58
55
 
59
56
  # Iterate through each sheet
@@ -102,7 +99,7 @@ s.cell(1,'A',s.sheets[1])
102
99
  ```
103
100
 
104
101
  #### Querying a spreadsheet
105
- Use ``each`` with a ``block`` to iterate over each row.
102
+ Use ``each`` to iterate over each row.
106
103
 
107
104
  If each is given a hash with the names of some columns, then each will generate a hash with the columns supplied for each row.
108
105
 
@@ -116,8 +113,8 @@ end
116
113
  Use ``sheet.parse`` to return an array of rows. Column names can be a ``String`` or a ``Regexp``.
117
114
 
118
115
  ```ruby
119
- sheet.parse(:id => /UPC|SKU/,:qty => /ATS*\sATP\s*QTY\z/)
120
- # => [{:upc => 727880013358, :qty => 12}, ...]
116
+ sheet.parse(id: /UPC|SKU/, qty: /ATS*\sATP\s*QTY\z/)
117
+ # => [{:id => 727880013358, :qty => 12}, ...]
121
118
  ```
122
119
 
123
120
  Use the ``:header_search`` option to locate the header row and assign the header names.
@@ -129,7 +126,7 @@ sheet.parse(header_search: [/UPC*SKU/,/ATS*\sATP\s*QTY\z/])
129
126
  Use the ``:clean`` option to strip out control characters and surrounding white space.
130
127
 
131
128
  ```ruby
132
- sheet.parse(:clean => true)
129
+ sheet.parse(clean: true)
133
130
  ```
134
131
 
135
132
  ### Exporting spreadsheets
@@ -143,7 +140,7 @@ sheet.to_xml
143
140
  sheet.to_yaml
144
141
  ```
145
142
 
146
- ### Excel (xlsx) Support
143
+ ### Excel (xlsx and xlsm) Support
147
144
 
148
145
  Stream rows from an Excelx spreadsheet.
149
146
 
@@ -154,6 +151,26 @@ xlsx.each_row_streaming do |row|
154
151
  end
155
152
  ```
156
153
 
154
+ By default blank cells will be excluded from the array. To keep them, use the option pad_cells = true. (They will be set to nil in the array)
155
+ ```ruby
156
+ xlsx.each_row_streaming(pad_cells: true) do |row|
157
+ puts row.inspect # Array of Excelx::Cell objects
158
+ end
159
+ ```
160
+
161
+ To stream only some of the rows, you can use the ```max_rows``` and ```offset```options.
162
+ ```ruby
163
+ xlsx.each_row_streaming(offset: 1) do |row| # Will exclude first (inevitably header) row
164
+ puts row.inspect # Array of Excelx::Cell objects
165
+ end
166
+ ```
167
+
168
+ ```ruby
169
+ xlsx.each_row_streaming(max_rows: 3) do |row| # Will yield 4 rows (it's automatically incremented by 1) after the supplied offset.
170
+ puts row.inspect # Array of Excelx::Cell objects
171
+ end
172
+ ```
173
+
157
174
  Iterate over each row
158
175
 
159
176
  ```ruby
@@ -172,6 +189,9 @@ xlsx.cell(3, 'C')
172
189
  # => 600000383.0
173
190
 
174
191
  xlsx.excelx_value(row,col)
192
+ # => '600000383'
193
+
194
+ xlsx.formatted_value(row,col)
175
195
  # => '0600000383'
176
196
  ```
177
197
 
@@ -185,11 +205,11 @@ xlsx.formula('A', 2)
185
205
 
186
206
  ### OpenOffice / LibreOffice Support
187
207
 
188
- Roo::OpenOffice supports for encrypted OpenOffice spreadsheets.
208
+ Roo::OpenOffice has support for encrypted OpenOffice spreadsheets.
189
209
 
190
210
  ```ruby
191
211
  # Load an encrypted OpenOffice Spreadsheet
192
- ods = Roo::OpenOffice.new("myspreadsheet.ods", :password => "password")
212
+ ods = Roo::OpenOffice.new("myspreadsheet.ods", password: "password")
193
213
  ```
194
214
 
195
215
  ``Roo::OpenOffice`` can access celltype, comments, font information, formulas and labels.
@@ -213,7 +233,7 @@ ods.formula('A', 2)
213
233
  s = Roo::CSV.new("mycsv.csv")
214
234
  ```
215
235
 
216
- Because Roo uses the [standard CSV library](), and you can use options available to that library to parse csv files. You can pass options using the ``csv_options`` key.
236
+ Because Roo uses the [standard CSV library](), you can use options available to that library to parse csv files. You can pass options using the ``csv_options`` key.
217
237
 
218
238
  For instance, you can load tab-delimited files (``.tsv``), and you can use a particular encoding when opening the file.
219
239
 
@@ -236,10 +256,24 @@ Roo's public methods have stayed relatively consistent between 1.13.x and 2.0.0,
236
256
  ## Contributing
237
257
  ### Features
238
258
  1. Fork it ( https://github.com/[my-github-username]/roo/fork )
239
- 2. Create your feature branch (`git checkout -b my-new-feature`)
240
- 3. Commit your changes (`git commit -am 'My new feature'`)
241
- 4. Push to the branch (`git push origin my-new-feature`)
242
- 5. Create a new Pull Request
259
+ 2. Install it (`bundle install --with local_development`)
260
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
261
+ 4. Commit your changes (`git commit -am 'My new feature'`)
262
+ 5. Push to the branch (`git push origin my-new-feature`)
263
+ 6. Create a new Pull Request
264
+
265
+ ### Testing
266
+ Roo uses Minitest and RSpec. The best of both worlds! Run `bundle exec rake` to
267
+ run the tests/examples.
268
+
269
+ You can run the tests/examples with Rspec like reporters by running
270
+ `USE_REPORTERS=true bundle exec rake`
271
+
272
+ Roo also has a few tests that take a long time (5+ seconds). To run these, use
273
+ `LONG_RUN=true bundle exec rake`
274
+
275
+ When testing using Ruby 2.0 or 2.1, use this command:
276
+ `BUNDLE_GEMFILE=Gemfile_ruby2 bundle exec rake`
243
277
 
244
278
  ### Issues
245
279
 
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'coveralls/rake/task'
7
7
  # Test unit
8
8
  Rake::TestTask.new do |t|
9
9
  t.libs << 'test'
10
- t.test_files = FileList['test/test*.rb']
10
+ t.test_files = FileList['test/**/test*.rb']
11
11
  t.verbose = true
12
12
  end
13
13