Skip to content

Commit 50e3fd8

Browse files
authored
Merge pull request #279 from ngiger/master
Updates for Ruby 3.4, StandardRB
2 parents b2c82d6 + ac38409 commit 50e3fd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+6804
-6448
lines changed

.github/workflows/ruby.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
matrix:
2626
os: [ ubuntu]
2727
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-ruby
28-
ruby: [2.1, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, jruby, head]
28+
ruby: [2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, jruby, head]
2929
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || endsWith(matrix.ruby, 'jruby') }}
3030
steps:
31-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v4
3232
- uses: ruby/setup-ruby@v1
3333
with:
3434
ruby-version: ${{ matrix.ruby }}

History.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
### 1.3.4 29.03.2025
2+
Author: Niklaus Giger <[email protected]>
3+
* Formatted using standardrb
4+
* Fixes for Ruby 3.4
5+
* Bumped minimal Ruby version to 2.6
6+
7+
### 1.3.3 20.11.2024
8+
9+
commit 6464ab51195eb3593fbc2feed7436d0b6b057f73
10+
Author: Edouard Brière <[email protected]>
11+
* Remove trailing slash from spec.homepage
12+
13+
### 1.3.2 15.1.2024
14+
commit a2f54fec58339818c54e4193eed21fbb72aceff9
15+
Author: Andrew Nesbitt <[email protected]>
16+
* Add funding_uri to gemspec
17+
118
### 1.3.1 15.1.2024
219
commit dd69d23f00427066cda8d2b30355e044b8c07eff
320
Author: Mark Young <[email protected]>

Rakefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# -*- ruby -*-
2-
require 'bundler'
3-
require_relative './lib/spreadsheet.rb'
4-
Bundler::GemHelper.install_tasks
2+
require "bundler/gem_tasks"
3+
require "standard/rake"
4+
5+
desc "test using minittest via test/suite.rb"
6+
task :test do |t|
7+
$LOAD_PATH << File.dirname(__FILE__)
8+
require "test/suite"
9+
end
510
# vim: syntax=Ruby

devenv.lock

Lines changed: 18 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
"devenv": {
44
"locked": {
55
"dir": "src/modules",
6-
"lastModified": 1705399223,
7-
"narHash": "sha256-2nhAJ/9LMlwaEZDnoDIhnhQ0pEC/YIIt09WD7FmTp6g=",
6+
"lastModified": 1736273305,
87
"owner": "cachix",
98
"repo": "devenv",
10-
"rev": "ff37923d4ba9e220b9826594e83fc29e1a4f4338",
9+
"rev": "cc48e044747cef4e4f69897e20a100adf5b716a3",
1110
"type": "github"
1211
},
1312
"original": {
@@ -20,11 +19,10 @@
2019
"flake-compat": {
2120
"flake": false,
2221
"locked": {
23-
"lastModified": 1696426674,
24-
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
22+
"lastModified": 1733328505,
2523
"owner": "edolstra",
2624
"repo": "flake-compat",
27-
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
25+
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
2826
"type": "github"
2927
},
3028
"original": {
@@ -36,11 +34,10 @@
3634
"flake-compat_2": {
3735
"flake": false,
3836
"locked": {
39-
"lastModified": 1696426674,
40-
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
37+
"lastModified": 1733328505,
4138
"owner": "edolstra",
4239
"repo": "flake-compat",
43-
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
40+
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
4441
"type": "github"
4542
},
4643
"original": {
@@ -54,29 +51,10 @@
5451
"systems": "systems"
5552
},
5653
"locked": {
57-
"lastModified": 1694529238,
58-
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
54+
"lastModified": 1731533236,
5955
"owner": "numtide",
6056
"repo": "flake-utils",
61-
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
62-
"type": "github"
63-
},
64-
"original": {
65-
"owner": "numtide",
66-
"repo": "flake-utils",
67-
"type": "github"
68-
}
69-
},
70-
"flake-utils_2": {
71-
"inputs": {
72-
"systems": "systems_2"
73-
},
74-
"locked": {
75-
"lastModified": 1701680307,
76-
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
77-
"owner": "numtide",
78-
"repo": "flake-utils",
79-
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
57+
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
8058
"type": "github"
8159
},
8260
"original": {
@@ -93,11 +71,10 @@
9371
]
9472
},
9573
"locked": {
96-
"lastModified": 1703887061,
97-
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
74+
"lastModified": 1709087332,
9875
"owner": "hercules-ci",
9976
"repo": "gitignore.nix",
100-
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
77+
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
10178
"type": "github"
10279
},
10380
"original": {
@@ -108,16 +85,15 @@
10885
},
10986
"nixpkgs": {
11087
"locked": {
111-
"lastModified": 1705331948,
112-
"narHash": "sha256-qjQXfvrAT1/RKDFAMdl8Hw3m4tLVvMCc8fMqzJv0pP4=",
88+
"lastModified": 1736200483,
11389
"owner": "NixOS",
11490
"repo": "nixpkgs",
115-
"rev": "b8dd8be3c790215716e7c12b247f45ca525867e2",
91+
"rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751",
11692
"type": "github"
11793
},
11894
"original": {
11995
"owner": "NixOS",
120-
"ref": "nixos-23.11",
96+
"ref": "nixos-24.11",
12197
"repo": "nixpkgs",
12298
"type": "github"
12399
}
@@ -131,11 +107,10 @@
131107
]
132108
},
133109
"locked": {
134-
"lastModified": 1705118282,
135-
"narHash": "sha256-9FUnVSPjF+xV2a7tfai8fxi9Ek538mdkEjaFJnWRk9Y=",
110+
"lastModified": 1735192621,
136111
"owner": "bobvanderlinden",
137112
"repo": "nixpkgs-ruby",
138-
"rev": "1a4b0055af39b2d0756d5a117589b8ccddbce4f8",
113+
"rev": "602c528c8228f231f912c6d117703a1700464202",
139114
"type": "github"
140115
},
141116
"original": {
@@ -144,38 +119,19 @@
144119
"type": "github"
145120
}
146121
},
147-
"nixpkgs-stable": {
148-
"locked": {
149-
"lastModified": 1704874635,
150-
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
151-
"owner": "NixOS",
152-
"repo": "nixpkgs",
153-
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
154-
"type": "github"
155-
},
156-
"original": {
157-
"owner": "NixOS",
158-
"ref": "nixos-23.11",
159-
"repo": "nixpkgs",
160-
"type": "github"
161-
}
162-
},
163122
"pre-commit-hooks": {
164123
"inputs": {
165124
"flake-compat": "flake-compat_2",
166-
"flake-utils": "flake-utils_2",
167125
"gitignore": "gitignore",
168126
"nixpkgs": [
169127
"nixpkgs"
170-
],
171-
"nixpkgs-stable": "nixpkgs-stable"
128+
]
172129
},
173130
"locked": {
174-
"lastModified": 1705229514,
175-
"narHash": "sha256-itILy0zimR/iyUGq5Dgg0fiW8plRDyxF153LWGsg3Cw=",
131+
"lastModified": 1735882644,
176132
"owner": "cachix",
177133
"repo": "pre-commit-hooks.nix",
178-
"rev": "ffa9a5b90b0acfaa03b1533b83eaf5dead819a05",
134+
"rev": "a5a961387e75ae44cc20f0a57ae463da5e959656",
179135
"type": "github"
180136
},
181137
"original": {
@@ -195,22 +151,6 @@
195151
"systems": {
196152
"locked": {
197153
"lastModified": 1681028828,
198-
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
199-
"owner": "nix-systems",
200-
"repo": "default",
201-
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
202-
"type": "github"
203-
},
204-
"original": {
205-
"owner": "nix-systems",
206-
"repo": "default",
207-
"type": "github"
208-
}
209-
},
210-
"systems_2": {
211-
"locked": {
212-
"lastModified": 1681028828,
213-
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
214154
"owner": "nix-systems",
215155
"repo": "default",
216156
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",

devenv.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
# languages.nix.enable = true;
1818

1919
languages.ruby.enable = true;
20-
languages.ruby.versionFile = ./.ruby-version;
20+
languages.ruby.version = "3.4";
21+
2122
# https://devenv.sh/pre-commit-hooks/
2223
# pre-commit.hooks.shellcheck.enable = true;
2324

devenv.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
inputs:
22
nixpkgs:
3-
url: github:NixOS/nixpkgs/nixos-23.11
3+
url: github:NixOS/nixpkgs/nixos-24.11
44
nixpkgs-ruby:
55
url: github:bobvanderlinden/nixpkgs-ruby
66
inputs:

lib/parseexcel.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
# 8006 Zürich
2525
### Switzerland
2626

27-
require 'parseexcel/parseexcel'
27+
require "parseexcel/parseexcel"

lib/parseexcel/parseexcel.rb

Lines changed: 66 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
require 'spreadsheet'
1+
require "spreadsheet"
22

3-
warn <<-EOS
4-
[DEPRECATED] By requiring 'parseexcel', 'parseexcel/parseexcel' and/or
5-
'parseexcel/parser' you are loading a Compatibility layer which
6-
provides a drop-in replacement for the ParseExcel library. This
7-
code makes the reading of Spreadsheet documents less efficient and
8-
will be removed in Spreadsheet version 1.0.0
3+
warn <<~EOS
4+
[DEPRECATED] By requiring 'parseexcel', 'parseexcel/parseexcel' and/or
5+
'parseexcel/parser' you are loading a Compatibility layer which
6+
provides a drop-in replacement for the ParseExcel library. This
7+
code makes the reading of Spreadsheet documents less efficient and
8+
will be removed in Spreadsheet version 1.0.0
99
EOS
1010

1111
module Spreadsheet
@@ -14,62 +14,70 @@ module Spreadsheet
1414
# ParseExcel library. This code is deprecated and will be removed in
1515
# Spreadsheet version 1.0.0
1616
module ParseExcel
17-
def ParseExcel.parse path
18-
Spreadsheet.open path
19-
end
20-
class Worksheet
21-
class Cell
22-
attr_accessor :value, :kind, :numeric, :code, :book,
23-
:format, :rich, :encoding, :annotation
24-
def initialize value, format, row, idx
25-
@format = format
26-
@idx = idx
27-
@row = row
28-
@value = value
29-
@encoding = Spreadsheet.client_encoding
30-
end
31-
def date
32-
@row.date @idx
33-
end
34-
def datetime
35-
@row.datetime @idx
36-
end
37-
def to_i
38-
@value.to_i
17+
def self.parse path
18+
Spreadsheet.open path
3919
end
40-
def to_f
41-
@value.to_f
42-
end
43-
def to_s(target_encoding=nil)
44-
if(target_encoding)
45-
begin
46-
Iconv.new(target_encoding, @encoding).iconv(@value)
47-
rescue
48-
Iconv.new(target_encoding, 'ascii').iconv(@value.to_s)
20+
21+
class Worksheet
22+
class Cell
23+
attr_accessor :value, :kind, :numeric, :code, :book,
24+
:format, :rich, :encoding, :annotation
25+
def initialize value, format, row, idx
26+
@format = format
27+
@idx = idx
28+
@row = row
29+
@value = value
30+
@encoding = Spreadsheet.client_encoding
31+
end
32+
33+
def date
34+
@row.date @idx
35+
end
36+
37+
def datetime
38+
@row.datetime @idx
39+
end
40+
41+
def to_i
42+
@value.to_i
43+
end
44+
45+
def to_f
46+
@value.to_f
47+
end
48+
49+
def to_s(target_encoding = nil)
50+
if target_encoding
51+
begin
52+
Iconv.new(target_encoding, @encoding).iconv(@value)
53+
rescue
54+
Iconv.new(target_encoding, "ascii").iconv(@value.to_s)
55+
end
56+
else
57+
@value.to_s
58+
end
59+
end
60+
61+
def type
62+
if @format && (@format.date? || @format.time?)
63+
:date
64+
elsif @value.is_a?(Numeric)
65+
:numeric
66+
else
67+
:text
68+
end
4969
end
50-
else
51-
@value.to_s
52-
end
53-
end
54-
def type
55-
if @format && (@format.date? || @format.time?)
56-
:date
57-
elsif @value.is_a?(Numeric)
58-
:numeric
59-
else
60-
:text
6170
end
6271
end
6372
end
64-
end
65-
end
73+
6674
module Excel
67-
class Reader # :nodoc: all
68-
def set_cell worksheet, row, column, xf, value=nil
69-
cells = @current_row_block[row] ||= Row.new(nil, row)
70-
cells.formats[column] = xf = @workbook.format(xf)
71-
cells[column] = ParseExcel::Worksheet::Cell.new(value, xf, cells, column)
72-
end
73-
end
75+
class Reader # :nodoc: all
76+
def set_cell worksheet, row, column, xf, value = nil
77+
cells = @current_row_block[row] ||= Row.new(nil, row)
78+
cells.formats[column] = xf = @workbook.format(xf)
79+
cells[column] = ParseExcel::Worksheet::Cell.new(value, xf, cells, column)
80+
end
81+
end
7482
end
7583
end

0 commit comments

Comments
 (0)