dreader 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.org +5 -0
- data/README.org +21 -5
- data/lib/dreader/engine.rb +5 -4
- data/lib/dreader/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 524e55af5bb94cae3f407a1602069549783e935798a638361f3c98e922ffc54d
|
4
|
+
data.tar.gz: 2599e048324ccd233e3fa4a0261e134ced0a3347d27af1e978e635639b6284a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8a78531d96ef35f9272a38daa5327620026dd66c98529710901d4c5994b9e5369308612cc79d1e0998d46dbb9dd6d26c448ddc4265dd536f1e61a4fc50fb885
|
7
|
+
data.tar.gz: de71caed5d3df79d0d456b080a72a0edc035ef4e46906aac3f94295b07d57b956554a9d9e07b4b6195c5c09df0badfa9202122d7b6e0568cf89569b6a2277d28
|
data/CHANGELOG.org
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
#+TITLE: Changelog
|
2
2
|
|
3
|
+
* Version 1.1.1 - <2023-10-16 Mon>
|
4
|
+
** Adds option :extension
|
5
|
+
|
6
|
+
- Adds options =extension= to the class options and to the =open_spreadsheet=
|
7
|
+
function, to be able to determine the type of a file with no extension
|
3
8
|
|
4
9
|
* Version 1.1.0
|
5
10
|
** Fixes an issue with visibility of variables
|
data/README.org
CHANGED
@@ -170,6 +170,7 @@ In the class specify parsing option, using the following syntax:
|
|
170
170
|
#+BEGIN_EXAMPLE ruby
|
171
171
|
options do
|
172
172
|
filename 'example.ods'
|
173
|
+
extension ".ods"
|
173
174
|
|
174
175
|
sheet 'Sheet 1'
|
175
176
|
|
@@ -185,10 +186,17 @@ In the class specify parsing option, using the following syntax:
|
|
185
186
|
|
186
187
|
where:
|
187
188
|
|
188
|
-
- (optional) =filename= is the file to read. If not specified, you will
|
189
|
-
|
190
|
-
|
191
|
-
|
189
|
+
- (optional) =filename= is the file to read. If not specified, you will have
|
190
|
+
to supply a filename when loading the file (see =read=, below). *Use
|
191
|
+
=.tsv= for tab-separated files.*
|
192
|
+
- (optional) =extension= overrides or specify the extension of =filename=.
|
193
|
+
Takes as input the extension preceded by a "." (e.g., ".xlsx"). Notice that
|
194
|
+
**value of this option is not appended to filename** (see =read= below).
|
195
|
+
Filename must thus be a valid reference to a file in the file system. This
|
196
|
+
option is useful in one of these two circumstances:
|
197
|
+
1. When =filename= has no extension
|
198
|
+
2. When you want to override the extension of the filename, e.g., to force
|
199
|
+
reading a "file.csv" as a tab separated file
|
192
200
|
- (optional) =first_row= is the first line to read (use =2= if your file
|
193
201
|
has a header)
|
194
202
|
- (optional) =last_row= is the last line to read. If not specified, we
|
@@ -451,9 +459,17 @@ A typical scenario works as follows:
|
|
451
459
|
|
452
460
|
#+BEGIN_EXAMPLE ruby
|
453
461
|
i = Reader
|
462
|
+
|
463
|
+
# read uses the options if defined and takes the same arguments as options
|
464
|
+
# examples:
|
465
|
+
# i.read
|
466
|
+
# i.read filename: "example.ods"
|
467
|
+
# i.read filename: "example.ods", extension: ".ods"
|
468
|
+
# i.read filename: "example", extension: ".ods"
|
469
|
+
# (the line above opens the file "example" as an Open Document Spreasdheet)
|
454
470
|
i.read
|
455
471
|
|
456
|
-
#
|
472
|
+
# alternately
|
457
473
|
Reader.read
|
458
474
|
#+END_EXAMPLE
|
459
475
|
|
data/lib/dreader/engine.rb
CHANGED
@@ -150,7 +150,7 @@ module Dreader
|
|
150
150
|
raise Exception
|
151
151
|
end
|
152
152
|
|
153
|
-
spreadsheet = open_spreadsheet
|
153
|
+
spreadsheet = open_spreadsheet(options)
|
154
154
|
sheet = spreadsheet.sheet(options[:sheet] || 0)
|
155
155
|
first_row = options[:first_row] || 1
|
156
156
|
last_row = options[:last_row] || sheet.last_row
|
@@ -324,7 +324,7 @@ module Dreader
|
|
324
324
|
def compare_headers(hash = {})
|
325
325
|
options = @declared_options.merge(hash)
|
326
326
|
|
327
|
-
spreadsheet = open_spreadsheet(options
|
327
|
+
spreadsheet = open_spreadsheet(options)
|
328
328
|
sheet = spreadsheet.sheet(options[:sheet] || 0)
|
329
329
|
header_row_number = options[:first_row] - 1 || 1
|
330
330
|
|
@@ -401,8 +401,9 @@ module Dreader
|
|
401
401
|
filename sheet first_row last_row logger logger_level
|
402
402
|
]
|
403
403
|
|
404
|
-
def open_spreadsheet(
|
405
|
-
|
404
|
+
def open_spreadsheet(options)
|
405
|
+
filename = options[:filename]
|
406
|
+
ext = options[:extension] || File.extname(filename)
|
406
407
|
|
407
408
|
case ext
|
408
409
|
when ".csv"
|
data/lib/dreader/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dreader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adolfo Villafiorita
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roo
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
145
|
+
rubygems_version: 3.4.10
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: Process and import data from cvs and spreadsheets
|