backports 3.11.1 → 3.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +8 -10
- data/lib/backports/rails/kernel.rb +15 -5
- data/lib/backports/tools/alias_method_chain.rb +6 -6
- data/lib/backports/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 544fc0fdfde45e2f7545c55cc240f9ea59d66107
|
4
|
+
data.tar.gz: 62f0dbfd4df084022ab983e17ab040647e906ef2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9659fda7635ff3b7c9949a72394ce390c52cb077f9ce46143cc89ad8d599c8653edc8b800a88a07581a3f562433bae32a4ff64b3ea9ed5b971f830173363fcb
|
7
|
+
data.tar.gz: 4c88602d22577ab20dd5fe704a0b043f76353856f6e52274159f575c6233386e27c1e27561e47aedccf78b4130b32b685b3f0bf781c90e2899733dfe2ebcc778
|
data/README.rdoc
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
= Backports Library {<img src="https://travis-ci.org/marcandre/backports.png?branch=master">}[https://travis-ci.org/marcandre/backports] {<img src="https://badge.fury.io/rb/backports.png" alt="Gem Version" />}[http://badge.fury.io/rb/backports]
|
1
|
+
= Backports Library {<img src="https://travis-ci.org/marcandre/backports.png?branch=master">}[https://travis-ci.org/marcandre/backports] {<img src="https://badge.fury.io/rb/backports.png" alt="Gem Version" />}[http://badge.fury.io/rb/backports]
|
2
2
|
|
3
|
-
|
4
|
-
* One of your client is stuck with Ruby 1.8.6 but you want to use a gem using some features of 1.8.7?
|
5
|
-
* Can't remember if you can use Array#sample or String#each_char on a friend's box?
|
3
|
+
Yearning to use some of the new cool features in Ruby 2.5 while using 2.3.x? Have some legacy code in Ruby 1.8 but can't live without `flat_map`?
|
6
4
|
|
7
5
|
This gem is for you!
|
8
6
|
|
@@ -12,12 +10,12 @@ The goal of 'backports' is to make it easier to write ruby code that runs across
|
|
12
10
|
|
13
11
|
=== Explicitly (recommended)
|
14
12
|
|
15
|
-
For example, if you want to use
|
13
|
+
For example, if you want to use transform_values and transform_keys, even in Ruby implementations that don't include it:
|
16
14
|
|
17
|
-
require 'backports/
|
18
|
-
require 'backports/2.
|
15
|
+
require 'backports/2.4.0/hash/transform_values'
|
16
|
+
require 'backports/2.5.0/hash/transform_keys'
|
19
17
|
|
20
|
-
This will enable
|
18
|
+
This will enable Hash#transform_values and Hash#transform_keys, using the native versions if available or otherwise provide a pure Ruby version.
|
21
19
|
|
22
20
|
=== By Module
|
23
21
|
|
@@ -52,9 +50,9 @@ For Ruby < 2.0, there are some real incompatibilities. For example, <tt>Module::
|
|
52
50
|
|
53
51
|
== Installation & compatibility
|
54
52
|
|
55
|
-
+backports+
|
53
|
+
+backports+ can be installed with:
|
56
54
|
|
57
|
-
|
55
|
+
gem install backports
|
58
56
|
|
59
57
|
To use:
|
60
58
|
|
@@ -1,6 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# From ActiveSupport
|
4
|
+
unless Object.method_defined? :try
|
5
|
+
class Object
|
6
|
+
def try(*a, &b)
|
7
|
+
try!(*a, &b) if a.empty? || respond_to?(a.first)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class NilClass
|
12
|
+
def try(*args)
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
end
|
6
16
|
end
|
@@ -14,12 +14,12 @@ module Backports
|
|
14
14
|
alias_method target, with_method
|
15
15
|
|
16
16
|
case
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
when public_method_defined?(without_method)
|
18
|
+
public target
|
19
|
+
when protected_method_defined?(without_method)
|
20
|
+
protected target
|
21
|
+
when private_method_defined?(without_method)
|
22
|
+
private target
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/backports/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.11.
|
4
|
+
version: 3.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc-André Lafortune
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Essential backports that enable many of the nice features of Ruby 1.8.7
|
14
14
|
up to 2.1.0 for earlier versions.
|