polyfill 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -6
- data/CHANGELOG.md +8 -1
- data/README.md +3 -1
- data/lib/polyfill.rb +12 -10
- data/lib/polyfill/internal_utils.rb +21 -6
- data/lib/polyfill/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96b0596352a22f8cf5311876f9fcf37056e58252fbeddcf85b068b64e32e2e59
|
4
|
+
data.tar.gz: fa748caa7b534b92beb1f02d74e30d734917311cd4d4354381bd62a9bfe93b49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa297f71b043d1456cf28810ebf8daa89745ca035a3b00c315f4097d0dc187500a549754e83fb2ddd36db8f7306837530ccb08ac8dae146f64bb5a3950f8283b
|
7
|
+
data.tar.gz: e3535ed0e215f4afe322636d51d250a5dbfb0d153fd84d32874bc923411465f9590eca111cb0d7f675aecd7b98d6c86aa642661bae85b2346b81828d79ba81b3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
# [1.
|
1
|
+
# [1.9.0][] (2020-12-12)
|
2
|
+
|
3
|
+
## Added
|
4
|
+
|
5
|
+
- Added support for repeatable srb runs from the sorbet gem.
|
6
|
+
|
7
|
+
# [1.8.0][] (2019-09-02)
|
2
8
|
|
3
9
|
## Added
|
4
10
|
|
@@ -288,6 +294,7 @@ incorrect type was passed:
|
|
288
294
|
- v2.4 String#concat?
|
289
295
|
- v2.4 String#prepend?
|
290
296
|
|
297
|
+
[1.9.0]: https://github.com/AaronLasseigne/polyfill/compare/v1.8.0...v1.9.0
|
291
298
|
[1.8.0]: https://github.com/AaronLasseigne/polyfill/compare/v1.7.0...v1.8.0
|
292
299
|
[1.7.0]: https://github.com/AaronLasseigne/polyfill/compare/v1.6.0...v1.7.0
|
293
300
|
[1.6.0]: https://github.com/AaronLasseigne/polyfill/compare/v1.5.0...v1.6.0
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
[![Version](https://img.shields.io/gem/v/polyfill.svg?style=flat-square)](https://rubygems.org/gems/polyfill)
|
4
4
|
[![Build](https://img.shields.io/travis/AaronLasseigne/polyfill.svg?style=flat-square)](https://travis-ci.org/AaronLasseigne/polyfill)
|
5
5
|
|
6
|
+
**This gem is no longer supported. I'd recommend exploring [ruby-next](https://github.com/ruby-next/ruby-next) as a replacement.**
|
7
|
+
|
6
8
|
Polyfill implements newer Ruby features into older versions. If the Ruby
|
7
9
|
version already supports the polyfill then calling it does nothing. This is
|
8
10
|
designed to allow gem maintainers to use newer methods and gain their
|
@@ -28,7 +30,7 @@ monkey patching** that may cause issues outside of your use.
|
|
28
30
|
Add it to your Gemfile:
|
29
31
|
|
30
32
|
```ruby
|
31
|
-
gem 'polyfill', '~> 1.
|
33
|
+
gem 'polyfill', '~> 1.9'
|
32
34
|
```
|
33
35
|
|
34
36
|
Or install it manually:
|
data/lib/polyfill.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative 'polyfill/version'
|
2
|
+
require_relative 'polyfill/internal_utils'
|
3
3
|
|
4
4
|
module Polyfill
|
5
5
|
module Module; end
|
@@ -9,10 +9,12 @@ module Polyfill
|
|
9
9
|
raise ArgumentError, "#{module_name} is a class not a module"
|
10
10
|
end
|
11
11
|
|
12
|
+
version_option = options.delete(:version)
|
13
|
+
|
12
14
|
#
|
13
15
|
# parse options
|
14
16
|
#
|
15
|
-
versions = InternalUtils.polyfill_versions_to_use(
|
17
|
+
versions = InternalUtils.polyfill_versions_to_use(version_option)
|
16
18
|
|
17
19
|
unless options.empty?
|
18
20
|
raise ArgumentError, "unknown keyword: #{options.first[0]}"
|
@@ -35,7 +37,7 @@ module Polyfill
|
|
35
37
|
#
|
36
38
|
# build the module to return
|
37
39
|
#
|
38
|
-
InternalUtils.create_module do |mod|
|
40
|
+
InternalUtils.create_module(module_name, methods, options, version_option) do |mod|
|
39
41
|
# make sure the methods get added if this module is included
|
40
42
|
mod.singleton_class.send(:define_method, :included) do |base|
|
41
43
|
modules.each do |module_to_add|
|
@@ -90,7 +92,7 @@ def Polyfill(options = {}) # rubocop:disable Naming/MethodName
|
|
90
92
|
#
|
91
93
|
# build the module to return
|
92
94
|
#
|
93
|
-
Polyfill::InternalUtils.create_module do |mod|
|
95
|
+
Polyfill::InternalUtils.create_module(options) do |mod|
|
94
96
|
objects.each do |object_name, methods|
|
95
97
|
#
|
96
98
|
# find all polyfills for the object across all versions
|
@@ -234,8 +236,8 @@ def Polyfill(options = {}) # rubocop:disable Naming/MethodName
|
|
234
236
|
end
|
235
237
|
end
|
236
238
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
239
|
+
require_relative 'polyfill/v2_2'
|
240
|
+
require_relative 'polyfill/v2_3'
|
241
|
+
require_relative 'polyfill/v2_4'
|
242
|
+
require_relative 'polyfill/v2_5'
|
243
|
+
require_relative 'polyfill/v2_6'
|
@@ -83,15 +83,30 @@ module Polyfill
|
|
83
83
|
end
|
84
84
|
module_function :methods_to_keep
|
85
85
|
|
86
|
-
def create_module
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
86
|
+
def create_module(*args)
|
87
|
+
module_name = namify_arguments(*args)
|
88
|
+
|
89
|
+
if ::Polyfill::Module.const_defined?(module_name, false)
|
90
|
+
::Polyfill::Module.const_get(module_name, false)
|
91
|
+
else
|
92
|
+
mod = ::Module.new
|
93
|
+
yield(mod)
|
94
|
+
::Polyfill::Module.const_set(module_name, mod)
|
95
|
+
end
|
92
96
|
end
|
93
97
|
module_function :create_module
|
94
98
|
|
99
|
+
def namify_arguments(*args)
|
100
|
+
string = args.map(&:inspect).join
|
101
|
+
# we don't need this to be decodable,
|
102
|
+
# we just need a consistent class-nameable output for a consistent arbitrary input
|
103
|
+
# safest module name is: start with capital then, A-Za-z0-9_
|
104
|
+
encoded = [string].pack('m0')
|
105
|
+
.gsub(%r{[+/=]}, '+' => '_1', '/' => '_2', '=' => '_')
|
106
|
+
"M#{encoded}"
|
107
|
+
end
|
108
|
+
module_function :namify_arguments
|
109
|
+
|
95
110
|
def to_str(obj)
|
96
111
|
begin
|
97
112
|
unless obj.respond_to?(:to_str)
|
data/lib/polyfill/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyfill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Lasseigne
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.57.0
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email:
|
57
57
|
- aaron.lasseigne@gmail.com
|
58
58
|
executables: []
|
@@ -135,7 +135,7 @@ homepage: ''
|
|
135
135
|
licenses:
|
136
136
|
- MIT
|
137
137
|
metadata: {}
|
138
|
-
post_install_message:
|
138
|
+
post_install_message:
|
139
139
|
rdoc_options: []
|
140
140
|
require_paths:
|
141
141
|
- lib
|
@@ -150,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
154
|
-
signing_key:
|
153
|
+
rubygems_version: 3.1.4
|
154
|
+
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Adds newer Ruby methods to older versions.
|
157
157
|
test_files: []
|