ruby3-backward-compatibility 1.1.1 → 1.2.0
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 +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +31 -2
- data/Rakefile +14 -2
- data/lib/ruby3_backward_compatibility/compatibility/all.rb +3 -0
- data/lib/ruby3_backward_compatibility/compatibility/dir.rb +5 -0
- data/lib/ruby3_backward_compatibility/compatibility/file.rb +5 -0
- data/lib/ruby3_backward_compatibility/compatibility/fixnum.rb +3 -0
- data/lib/ruby3_backward_compatibility/version.rb +1 -1
- data/lib/ruby3_backward_compatibility.rb +0 -2
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9eab8bda5ea5cf123ec7370aae33a25c1e6d3fe16976a778152d3fce153931c
|
4
|
+
data.tar.gz: 550c09a1aa034b4899f4e21d69b7a2949ec16c15bce430e6a23acf72eb91ad37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 645183527ce9549cebfe84924fcff6d8864088a1ef442fb797f6cc1225f2348aba11c170edb58d7633b396a89d5bb327c2863789bb4b4d893e8c15aaad5900b0
|
7
|
+
data.tar.gz: 6e6382750d9f27dda6195b5cc637bb2dae6b57dfd46ab7afa67dcd0992709017a05771d376f0064b5298db7157ae3cdd8ba1b43ac404df5df6491bafc13ac12b
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.2.0] - 2024-04-10
|
4
|
+
|
5
|
+
- First release with dedicated suport to Ruby 3.3.
|
6
|
+
- Added back `File.exists?` and `Dir.exists?` on Ruby 3.2+.
|
7
|
+
- Added back `Fixnum` as an alias for `Integer`.
|
8
|
+
|
3
9
|
## [1.1.1] - 2022-12-01
|
4
10
|
|
5
11
|
- Gem no longer requires Ruby 3. It will not do anything when used on Ruby 2.x, but you can add it to your Gemfile if you need that for a Ruby migration strategy. (Thanks to @BigAirJosh)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -71,6 +71,16 @@ This will wrap the given method and convert a hash given as the last argument in
|
|
71
71
|
|
72
72
|
*Note:* In case the method is also defined in a prepended module, you need to put the `extend Ruby3BackwardCompatibility::CallableWithHash` above the `prepend`.
|
73
73
|
|
74
|
+
### Dir
|
75
|
+
|
76
|
+
`Dir.exists?` has been removed in favor of `Dir.exist?`.
|
77
|
+
|
78
|
+
To add `Dir.exists?` as an alias for `Dir.exist?`, use
|
79
|
+
|
80
|
+
```
|
81
|
+
require 'ruby3_backward_compatibility/compatibility/dir'
|
82
|
+
```
|
83
|
+
|
74
84
|
### ERB
|
75
85
|
|
76
86
|
`ERB.new` used to have the signature
|
@@ -91,6 +101,25 @@ To allow both styles, use
|
|
91
101
|
require 'ruby3_backward_compatibility/compatibility/erb'
|
92
102
|
```
|
93
103
|
|
104
|
+
### File
|
105
|
+
|
106
|
+
`File.exists?` has been removed in favor of `File.exist?`.
|
107
|
+
|
108
|
+
To add `File.exists?` as an alias for `File.exist?`, use
|
109
|
+
|
110
|
+
```
|
111
|
+
require 'ruby3_backward_compatibility/compatibility/file'
|
112
|
+
```
|
113
|
+
|
114
|
+
### Fixnum
|
115
|
+
|
116
|
+
`Fixnum` has been an alias for `Integer` for a while, but was removed.
|
117
|
+
|
118
|
+
To add back `Fixnum` as an alias for `Integer`, use
|
119
|
+
|
120
|
+
```
|
121
|
+
require 'ruby3_backward_compatibility/compatibility/fixnum'
|
122
|
+
```
|
94
123
|
|
95
124
|
### I18n
|
96
125
|
|
@@ -130,13 +159,13 @@ Psych version 4 (default for Ruby 3.1) has two changes:
|
|
130
159
|
Psych.safe_load(yaml, permitted_classes: [], permitted_symbols: [], aliases: false, filename: nil)
|
131
160
|
```
|
132
161
|
|
133
|
-
To
|
162
|
+
To allow both styles of calling `Psych.safe_load`, use
|
134
163
|
|
135
164
|
```
|
136
165
|
require 'ruby3_backward_compatibility/compatibility/psych'
|
137
166
|
```
|
138
167
|
|
139
|
-
**Attention:** There has been a very good reason why Psych renamed the `.load` method: You may never use `.load` on any external strings. It is possible to create valid YAML strings that lead to the execution of arbitrary code, so calling `YAML.load` on user input is a major security vulnerability.
|
168
|
+
**Attention:** There has been a very good reason why Psych renamed the `.load` method: You may never use `.load` on any external strings. It is possible to create valid YAML strings that lead to the execution of arbitrary code, so calling `YAML.load` on user input is a major security vulnerability. For that reason, this library does not change the safe behavior of `YAML.load`.
|
140
169
|
|
141
170
|
|
142
171
|
### String
|
data/Rakefile
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
5
|
|
6
|
-
|
6
|
+
ruby2_specs = 'spec/ruby2/**/*_spec.rb'
|
7
|
+
rake_task = RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
if RUBY_VERSION < '3'
|
10
|
+
rake_task.pattern = 'spec/ruby2/**/*_spec.rb'
|
11
|
+
task default: :spec
|
12
|
+
else
|
13
|
+
rake_task.exclude_pattern = 'spec/{ruby2,isolated}/**/*_spec.rb'
|
14
|
+
|
15
|
+
isolated_rake_task = RSpec::Core::RakeTask.new(:isolated_specs)
|
16
|
+
isolated_rake_task.pattern = 'spec/isolated/**/*_spec.rb'
|
17
|
+
|
18
|
+
task default: [:spec, :isolated_specs]
|
19
|
+
end
|
7
20
|
|
8
|
-
task default: :spec
|
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'ruby3_backward_compatibility'
|
2
2
|
|
3
|
+
require 'ruby3_backward_compatibility/compatibility/dir'
|
3
4
|
require 'ruby3_backward_compatibility/compatibility/erb' if defined?(ERB)
|
5
|
+
require 'ruby3_backward_compatibility/compatibility/file'
|
6
|
+
require 'ruby3_backward_compatibility/compatibility/fixnum'
|
4
7
|
require 'ruby3_backward_compatibility/compatibility/i18n' if defined?(I18n)
|
5
8
|
require 'ruby3_backward_compatibility/compatibility/object'
|
6
9
|
require 'ruby3_backward_compatibility/compatibility/psych' if defined?(Psych)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby3-backward-compatibility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Kraze
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -45,7 +45,10 @@ files:
|
|
45
45
|
- lib/ruby3_backward_compatibility.rb
|
46
46
|
- lib/ruby3_backward_compatibility/callable_with_hash.rb
|
47
47
|
- lib/ruby3_backward_compatibility/compatibility/all.rb
|
48
|
+
- lib/ruby3_backward_compatibility/compatibility/dir.rb
|
48
49
|
- lib/ruby3_backward_compatibility/compatibility/erb.rb
|
50
|
+
- lib/ruby3_backward_compatibility/compatibility/file.rb
|
51
|
+
- lib/ruby3_backward_compatibility/compatibility/fixnum.rb
|
49
52
|
- lib/ruby3_backward_compatibility/compatibility/i18n.rb
|
50
53
|
- lib/ruby3_backward_compatibility/compatibility/object.rb
|
51
54
|
- lib/ruby3_backward_compatibility/compatibility/psych.rb
|
@@ -75,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
78
|
- !ruby/object:Gem::Version
|
76
79
|
version: '0'
|
77
80
|
requirements: []
|
78
|
-
rubygems_version: 3.3
|
81
|
+
rubygems_version: 3.5.3
|
79
82
|
signing_key:
|
80
83
|
specification_version: 4
|
81
84
|
summary: Backward compatibility for Ruby 3 stdlib
|