backports 3.9.1 → 3.10.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
  SHA1:
3
- metadata.gz: 7c118b5ba5463c0bdac0657f7684ba3a1d90f27c
4
- data.tar.gz: 4e957388dd11e62d88ed07fde260281821343cc8
3
+ metadata.gz: 57fb341f28684c6358b9c1c5f65a0524bd24c3d3
4
+ data.tar.gz: f3299e7676fbbdb9f8d58336b4c930553713cd48
5
5
  SHA512:
6
- metadata.gz: 2317868ee805dbf1b649dc3e9c0a41e7978825f2261567213ab823f4b31e29652bbc4b96b641023ce77cdfe9a1d322dbed1540b183917c64f8e972f601956512
7
- data.tar.gz: 8106c6a77152559e60133020615dc807806e11cf3ae8f5cd3fd305853b8e12b6bbad0937396b68df98f4721e469b3734e665a6e90ae0fbaf537b69e5aee157e4
6
+ metadata.gz: cfd754b5f4b85b4852bede115f9b2955d7b48f6588621492169679f329646c55044b9b51e8de91633fc690747f57545dc9079bd3daa94bbf06545389ab149704
7
+ data.tar.gz: de1f1211ea9454930e44a79241b88e720cf4a1adaae2f7f8dbc0d678c90b1964ba98d363c82bd57583931f297bf3004b0d47c9a1ff00cc958c95ac3291c0a965
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ rdoc
6
6
  pkg
7
7
  assets
8
8
  rs
9
+ Gemfile.lock
@@ -72,6 +72,12 @@ Compatible with Ruby itself, JRuby and Rubinius.
72
72
 
73
73
  * Comparable
74
74
  * +clamp+
75
+ * Enumerable
76
+ * +sum+
77
+ * +uniq+
78
+ * Hash
79
+ * +compact+, +compact!+
80
+ * +transform_values+, +transform_values!+
75
81
  * Regexp
76
82
  * +match?+
77
83
  * String
data/Rakefile CHANGED
@@ -128,6 +128,10 @@ IGNORE_IN_19 = %w[
128
128
  2.1.0/array/to_h
129
129
  2.1.0/module/include
130
130
  ]
131
+ # These **new** specs cause actual errors while loading in 2.0.0:
132
+ IGNORE_IN_200 = %w[
133
+ 2.4.0/enumerable/sum
134
+ ]
131
135
 
132
136
  CLASS_MAP = Hash.new{|k, v| k[v] = v}.merge!(
133
137
  'match_data' => 'matchdata', # don't ask me why RubySpec uses matchdata instead of match_data
@@ -148,6 +152,7 @@ def mspec_cmds(pattern, spec_folder, action='ci')
148
152
  next if IGNORE_IN_19.include? version_path
149
153
  next if spec_folder != 'frozen_old_spec' && version <= '2.0.0' # Don't run new specs for pre 2.0 features & ruby
150
154
  end
155
+ next if RUBY_VERSION < '2.1.0' && IGNORE_IN_200.include?(version_path)
151
156
  deps = [*DEPENDENCIES[version_path]].map{|p| "-r #{p}"}.join(' ')
152
157
  klass, method = path.split('/')
153
158
  path = [CLASS_MAP[klass], method].join('/')
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,6 @@
1
+ module Enumerable
2
+ def sum(accumulator = 0, &block)
3
+ values = block_given? ? map(&block) : self
4
+ values.inject(accumulator, :+)
5
+ end unless method_defined? :sum
6
+ end
@@ -0,0 +1,5 @@
1
+ module Enumerable
2
+ def uniq(&block)
3
+ to_a.uniq(&block)
4
+ end unless method_defined? :uniq
5
+ end
@@ -0,0 +1,3 @@
1
+ require 'backports/tools/require_relative_dir'
2
+
3
+ Backports.require_relative_dir
@@ -0,0 +1,13 @@
1
+ class Hash
2
+ def compact
3
+ h = {}
4
+ each do |key, value|
5
+ h[key] = value unless value == nil
6
+ end
7
+ h
8
+ end unless method_defined? :compact
9
+
10
+ def compact!
11
+ reject! {|_key, value| value == nil}
12
+ end unless method_defined? :compact!
13
+ end
@@ -0,0 +1,15 @@
1
+ class Hash
2
+ def transform_values
3
+ return to_enum(:transform_values){ size } unless block_given?
4
+ h = {}
5
+ each do |key, value|
6
+ h[key] = yield value
7
+ end
8
+ h
9
+ end unless method_defined? :transform_values
10
+
11
+ def transform_values!
12
+ return to_enum(:transform_values!){ size } unless block_given?
13
+ replace(transform_values{|i| yield i})
14
+ end unless method_defined? :transform_values!
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Backports
2
- VERSION = "3.9.1" unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
2
+ VERSION = "3.10.0" unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
3
3
  end
@@ -0,0 +1,2 @@
1
+ fails:Hash#transform_values when no block is given returns a sized Enumerator
2
+ fails:Hash#transform_values! when no block is given returns a sized Enumerator
@@ -0,0 +1,2 @@
1
+ fails:Hash#transform_values when no block is given returns a sized Enumerator
2
+ fails:Hash#transform_values! when no block is given returns a sized Enumerator
@@ -0,0 +1,2 @@
1
+ fails:Hash#transform_values when no block is given returns a sized Enumerator
2
+ fails:Hash#transform_values! when no block is given returns a sized Enumerator
@@ -0,0 +1,2 @@
1
+ fails:Hash#transform_values when no block is given returns a sized Enumerator
2
+ fails:Hash#transform_values! when no block is given returns a sized Enumerator
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.9.1
4
+ version: 3.10.0
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: 2017-10-07 00:00:00.000000000 Z
11
+ date: 2017-10-11 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.
@@ -18,14 +18,13 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - ".document"
22
- - ".gitignore"
23
- - ".gitmodules"
24
- - ".irbrc"
25
- - ".travis.yml"
21
+ - .document
22
+ - .gitignore
23
+ - .gitmodules
24
+ - .irbrc
25
+ - .travis.yml
26
26
  - CHANGELOG.rdoc
27
27
  - Gemfile
28
- - Gemfile.lock
29
28
  - LICENSE.txt
30
29
  - README.rdoc
31
30
  - Rakefile
@@ -561,12 +560,18 @@ files:
561
560
  - lib/backports/2.4.0.rb
562
561
  - lib/backports/2.4.0/comparable.rb
563
562
  - lib/backports/2.4.0/comparable/clamp.rb
563
+ - lib/backports/2.4.0/enumerable.rb
564
+ - lib/backports/2.4.0/enumerable/sum.rb
565
+ - lib/backports/2.4.0/enumerable/uniq.rb
564
566
  - lib/backports/2.4.0/false_class.rb
565
567
  - lib/backports/2.4.0/false_class/dup.rb
566
568
  - lib/backports/2.4.0/fixnum.rb
567
569
  - lib/backports/2.4.0/fixnum/dup.rb
568
570
  - lib/backports/2.4.0/float.rb
569
571
  - lib/backports/2.4.0/float/dup.rb
572
+ - lib/backports/2.4.0/hash.rb
573
+ - lib/backports/2.4.0/hash/compact.rb
574
+ - lib/backports/2.4.0/hash/transform_values.rb
570
575
  - lib/backports/2.4.0/nil_class.rb
571
576
  - lib/backports/2.4.0/nil_class/dup.rb
572
577
  - lib/backports/2.4.0/regexp.rb
@@ -646,6 +651,7 @@ files:
646
651
  - spec/tags/1.8.6/core/hash/rassoc_spec.rb
647
652
  - spec/tags/1.8.6/core/hash/reject_spec.rb
648
653
  - spec/tags/1.8.6/core/hash/select_spec.rb
654
+ - spec/tags/1.8.6/core/hash/transform_values_spec.rb
649
655
  - spec/tags/1.8.6/core/integer/round_spec.rb
650
656
  - spec/tags/1.8.6/core/io/binread_spec.rb
651
657
  - spec/tags/1.8.6/core/io/chars_spec.rb
@@ -701,6 +707,7 @@ files:
701
707
  - spec/tags/1.8.7/core/hash/keep_if_spec.rb
702
708
  - spec/tags/1.8.7/core/hash/rassoc_spec.rb
703
709
  - spec/tags/1.8.7/core/hash/select_spec.rb
710
+ - spec/tags/1.8.7/core/hash/transform_values_spec.rb
704
711
  - spec/tags/1.8.7/core/integer/round_spec.rb
705
712
  - spec/tags/1.8.7/core/io/binread_spec.rb
706
713
  - spec/tags/1.8.7/core/io/open_spec.rb
@@ -732,9 +739,11 @@ files:
732
739
  - spec/tags/1.9.1/core/array/rotate_spec.rb
733
740
  - spec/tags/1.9.1/core/env/to_h_spec.rb
734
741
  - spec/tags/1.9.1/core/hash/default_proc_spec.rb
742
+ - spec/tags/1.9.1/core/hash/transform_values_spec.rb
735
743
  - spec/tags/1.9.1/core/io/write_spec.rb
736
744
  - spec/tags/1.9.1/core/string/uplus_spec.rb
737
745
  - spec/tags/1.9.2/core/array/bsearch_index_spec.rb
746
+ - spec/tags/1.9.2/core/hash/transform_values_spec.rb
738
747
  - spec/tags/1.9.2/core/io/write_spec.rb
739
748
  - spec/tags/1.9.2/core/method/curry_spec.rb
740
749
  - spec/tags/1.9.2/core/string/uplus_spec.rb
@@ -762,17 +771,17 @@ require_paths:
762
771
  - lib
763
772
  required_ruby_version: !ruby/object:Gem::Requirement
764
773
  requirements:
765
- - - ">="
774
+ - - '>='
766
775
  - !ruby/object:Gem::Version
767
776
  version: '0'
768
777
  required_rubygems_version: !ruby/object:Gem::Requirement
769
778
  requirements:
770
- - - ">="
779
+ - - '>='
771
780
  - !ruby/object:Gem::Version
772
781
  version: '0'
773
782
  requirements: []
774
783
  rubyforge_project:
775
- rubygems_version: 2.6.13
784
+ rubygems_version: 2.4.8
776
785
  signing_key:
777
786
  specification_version: 4
778
787
  summary: Backports of Ruby features for older Ruby.
@@ -806,6 +815,7 @@ test_files:
806
815
  - spec/tags/1.8.6/core/hash/rassoc_spec.rb
807
816
  - spec/tags/1.8.6/core/hash/reject_spec.rb
808
817
  - spec/tags/1.8.6/core/hash/select_spec.rb
818
+ - spec/tags/1.8.6/core/hash/transform_values_spec.rb
809
819
  - spec/tags/1.8.6/core/integer/round_spec.rb
810
820
  - spec/tags/1.8.6/core/io/binread_spec.rb
811
821
  - spec/tags/1.8.6/core/io/chars_spec.rb
@@ -861,6 +871,7 @@ test_files:
861
871
  - spec/tags/1.8.7/core/hash/keep_if_spec.rb
862
872
  - spec/tags/1.8.7/core/hash/rassoc_spec.rb
863
873
  - spec/tags/1.8.7/core/hash/select_spec.rb
874
+ - spec/tags/1.8.7/core/hash/transform_values_spec.rb
864
875
  - spec/tags/1.8.7/core/integer/round_spec.rb
865
876
  - spec/tags/1.8.7/core/io/binread_spec.rb
866
877
  - spec/tags/1.8.7/core/io/open_spec.rb
@@ -892,9 +903,11 @@ test_files:
892
903
  - spec/tags/1.9.1/core/array/rotate_spec.rb
893
904
  - spec/tags/1.9.1/core/env/to_h_spec.rb
894
905
  - spec/tags/1.9.1/core/hash/default_proc_spec.rb
906
+ - spec/tags/1.9.1/core/hash/transform_values_spec.rb
895
907
  - spec/tags/1.9.1/core/io/write_spec.rb
896
908
  - spec/tags/1.9.1/core/string/uplus_spec.rb
897
909
  - spec/tags/1.9.2/core/array/bsearch_index_spec.rb
910
+ - spec/tags/1.9.2/core/hash/transform_values_spec.rb
898
911
  - spec/tags/1.9.2/core/io/write_spec.rb
899
912
  - spec/tags/1.9.2/core/method/curry_spec.rb
900
913
  - spec/tags/1.9.2/core/string/uplus_spec.rb
@@ -1,32 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- backports (3.9.1)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- activesupport (3.2.13)
10
- i18n (= 0.6.1)
11
- multi_json (~> 1.0)
12
- i18n (0.6.1)
13
- minitest (4.7.5)
14
- mspec (1.9.1)
15
- multi_json (1.7.2)
16
- rake (10.1.0)
17
- test-unit (2.1.1.0)
18
-
19
- PLATFORMS
20
- java
21
- ruby
22
-
23
- DEPENDENCIES
24
- activesupport
25
- backports!
26
- minitest (< 5.0.0)
27
- mspec
28
- rake
29
- test-unit
30
-
31
- BUNDLED WITH
32
- 1.15.4