ruby3-backward-compatibility 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e72c4f9ed9be362ed3bcc227865c004eb1c87ba49a878f47fe8aa0af60503744
4
- data.tar.gz: d362dbf046076652989f7530b7cbe5f6acc36dd5f45ed3d5be930f56cbedbbfb
3
+ metadata.gz: b9eab8bda5ea5cf123ec7370aae33a25c1e6d3fe16976a778152d3fce153931c
4
+ data.tar.gz: 550c09a1aa034b4899f4e21d69b7a2949ec16c15bce430e6a23acf72eb91ad37
5
5
  SHA512:
6
- metadata.gz: 9ea7a3617ed5bcf3664d376827ee1f5a8e6c3b2aaac33af0460f3c43b8787e535b917a81d448d8e2b3935977c64b2e80c0bc8eba2d7fb7c0d6c06d673b8842bd
7
- data.tar.gz: e2fdbf510be4111c4dc4611432eddd696b75db90dca65a023f98f7a61a9ca1a8a270dcbffaa905d480bdd04ef1de584bb41aff8b406e974c7fb646966071f134
6
+ metadata.gz: 645183527ce9549cebfe84924fcff6d8864088a1ef442fb797f6cc1225f2348aba11c170edb58d7633b396a89d5bb327c2863789bb4b4d893e8c15aaad5900b0
7
+ data.tar.gz: 6e6382750d9f27dda6195b5cc637bb2dae6b57dfd46ab7afa67dcd0992709017a05771d376f0064b5298db7157ae3cdd8ba1b43ac404df5df6491bafc13ac12b
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.2
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby3-backward-compatibility (1.1.0)
4
+ ruby3-backward-compatibility (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 alias `Psych.unsafe_load` as `Psych.load`, and to allow both styles of calling `Psych.safe_load`, use
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
- RSpec::Core::RakeTask.new(:spec)
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)
@@ -0,0 +1,5 @@
1
+ class Dir
2
+ class << self
3
+ alias_method :exists?, :exist? unless method_defined?(:exists?)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class File
2
+ class << self
3
+ alias_method :exists?, :exist? unless method_defined?(:exists?)
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ unless defined?(::Fixnum)
2
+ Fixnum = Integer
3
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ruby3BackwardCompatibility
4
- VERSION = '1.1.1'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -3,8 +3,6 @@
3
3
  if RUBY_VERSION.start_with?('3')
4
4
  module Ruby3BackwardCompatibility
5
5
  NOT_GIVEN = Object.new
6
-
7
- # TODO private?
8
6
  end
9
7
 
10
8
  require 'ruby3_backward_compatibility/callable_with_hash'
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.1.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: 2023-02-23 00:00:00.000000000 Z
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.7
81
+ rubygems_version: 3.5.3
79
82
  signing_key:
80
83
  specification_version: 4
81
84
  summary: Backward compatibility for Ruby 3 stdlib