backports 2.5.1 → 2.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/backports.gemspec +103 -104
- data/lib/backports/1.8.7/argf.rb +5 -7
- data/lib/backports/1.8.7/integer.rb +2 -1
- data/lib/backports/1.8.7/io.rb +2 -2
- data/lib/backports/1.8.7/struct.rb +1 -1
- data/lib/backports/tools.rb +9 -5
- metadata +24 -41
- data/.gitignore +0 -8
data/VERSION.yml
CHANGED
data/backports.gemspec
CHANGED
@@ -1,126 +1,125 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "backports"
|
8
|
-
s.version = "2.5.
|
8
|
+
s.version = "2.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Marc-Andr\
|
12
|
-
s.date = "2012-
|
11
|
+
s.authors = ["Marc-Andr\u{e9} Lafortune"]
|
12
|
+
s.date = "2012-05-07"
|
13
13
|
s.description = " Essential backports that enable some of the really nice features of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.\n"
|
14
14
|
s.email = "github@marc-andre.ca"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
"test/README"
|
21
|
+
".irbrc",
|
22
|
+
"CHANGELOG.rdoc",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION.yml",
|
27
|
+
"backports.gemspec",
|
28
|
+
"lib/backports.rb",
|
29
|
+
"lib/backports/1.8.7.rb",
|
30
|
+
"lib/backports/1.8.7/argf.rb",
|
31
|
+
"lib/backports/1.8.7/array.rb",
|
32
|
+
"lib/backports/1.8.7/binding.rb",
|
33
|
+
"lib/backports/1.8.7/dir.rb",
|
34
|
+
"lib/backports/1.8.7/enumerable.rb",
|
35
|
+
"lib/backports/1.8.7/enumerator.rb",
|
36
|
+
"lib/backports/1.8.7/env.rb",
|
37
|
+
"lib/backports/1.8.7/fixnum.rb",
|
38
|
+
"lib/backports/1.8.7/float.rb",
|
39
|
+
"lib/backports/1.8.7/gc.rb",
|
40
|
+
"lib/backports/1.8.7/hash.rb",
|
41
|
+
"lib/backports/1.8.7/integer.rb",
|
42
|
+
"lib/backports/1.8.7/io.rb",
|
43
|
+
"lib/backports/1.8.7/kernel.rb",
|
44
|
+
"lib/backports/1.8.7/method.rb",
|
45
|
+
"lib/backports/1.8.7/module.rb",
|
46
|
+
"lib/backports/1.8.7/numeric.rb",
|
47
|
+
"lib/backports/1.8.7/object_space.rb",
|
48
|
+
"lib/backports/1.8.7/proc.rb",
|
49
|
+
"lib/backports/1.8.7/process.rb",
|
50
|
+
"lib/backports/1.8.7/range.rb",
|
51
|
+
"lib/backports/1.8.7/regexp.rb",
|
52
|
+
"lib/backports/1.8.7/string.rb",
|
53
|
+
"lib/backports/1.8.7/struct.rb",
|
54
|
+
"lib/backports/1.8.7/symbol.rb",
|
55
|
+
"lib/backports/1.8.8.rb",
|
56
|
+
"lib/backports/1.8.rb",
|
57
|
+
"lib/backports/1.9.1.rb",
|
58
|
+
"lib/backports/1.9.1/array.rb",
|
59
|
+
"lib/backports/1.9.1/dir.rb",
|
60
|
+
"lib/backports/1.9.1/enumerable.rb",
|
61
|
+
"lib/backports/1.9.1/enumerator.rb",
|
62
|
+
"lib/backports/1.9.1/env.rb",
|
63
|
+
"lib/backports/1.9.1/file.rb",
|
64
|
+
"lib/backports/1.9.1/float.rb",
|
65
|
+
"lib/backports/1.9.1/hash.rb",
|
66
|
+
"lib/backports/1.9.1/integer.rb",
|
67
|
+
"lib/backports/1.9.1/io.rb",
|
68
|
+
"lib/backports/1.9.1/kernel.rb",
|
69
|
+
"lib/backports/1.9.1/math.rb",
|
70
|
+
"lib/backports/1.9.1/numeric.rb",
|
71
|
+
"lib/backports/1.9.1/proc.rb",
|
72
|
+
"lib/backports/1.9.1/range.rb",
|
73
|
+
"lib/backports/1.9.1/regexp.rb",
|
74
|
+
"lib/backports/1.9.1/stdlib.rb",
|
75
|
+
"lib/backports/1.9.1/stdlib/prime.rb",
|
76
|
+
"lib/backports/1.9.1/string.rb",
|
77
|
+
"lib/backports/1.9.1/symbol.rb",
|
78
|
+
"lib/backports/1.9.2.rb",
|
79
|
+
"lib/backports/1.9.2/array.rb",
|
80
|
+
"lib/backports/1.9.2/complex.rb",
|
81
|
+
"lib/backports/1.9.2/dir.rb",
|
82
|
+
"lib/backports/1.9.2/enumerable.rb",
|
83
|
+
"lib/backports/1.9.2/float.rb",
|
84
|
+
"lib/backports/1.9.2/hash.rb",
|
85
|
+
"lib/backports/1.9.2/kernel.rb",
|
86
|
+
"lib/backports/1.9.2/match_data.rb",
|
87
|
+
"lib/backports/1.9.2/random.rb",
|
88
|
+
"lib/backports/1.9.2/random/MT19937.rb",
|
89
|
+
"lib/backports/1.9.2/random/bits_and_bytes.rb",
|
90
|
+
"lib/backports/1.9.2/random/implementation.rb",
|
91
|
+
"lib/backports/1.9.2/random/load.rb",
|
92
|
+
"lib/backports/1.9.2/stdlib.rb",
|
93
|
+
"lib/backports/1.9.2/stdlib/matrix.rb",
|
94
|
+
"lib/backports/1.9.2/stdlib/matrix/eigenvalue_decomposition.rb",
|
95
|
+
"lib/backports/1.9.2/stdlib/matrix/lup_decomposition.rb",
|
96
|
+
"lib/backports/1.9.2/stdlib/set.rb",
|
97
|
+
"lib/backports/1.9.3.rb",
|
98
|
+
"lib/backports/1.9.3/file.rb",
|
99
|
+
"lib/backports/1.9.3/io.rb",
|
100
|
+
"lib/backports/1.9.3/string.rb",
|
101
|
+
"lib/backports/1.9.rb",
|
102
|
+
"lib/backports/basic_object.rb",
|
103
|
+
"lib/backports/force/array_map.rb",
|
104
|
+
"lib/backports/force/enumerable_map.rb",
|
105
|
+
"lib/backports/force/hash_select.rb",
|
106
|
+
"lib/backports/force/string_length.rb",
|
107
|
+
"lib/backports/force/string_size.rb",
|
108
|
+
"lib/backports/rails.rb",
|
109
|
+
"lib/backports/rails/array.rb",
|
110
|
+
"lib/backports/rails/enumerable.rb",
|
111
|
+
"lib/backports/rails/hash.rb",
|
112
|
+
"lib/backports/rails/kernel.rb",
|
113
|
+
"lib/backports/rails/module.rb",
|
114
|
+
"lib/backports/rails/string.rb",
|
115
|
+
"lib/backports/tools.rb",
|
116
|
+
"test/README"
|
118
117
|
]
|
119
118
|
s.homepage = "http://github.com/marcandre/backports"
|
120
|
-
s.rdoc_options = ["--
|
119
|
+
s.rdoc_options = ["--title", "Backports library", "--main", "README.rdoc", "--line-numbers", "--inline-source"]
|
121
120
|
s.require_paths = ["lib"]
|
122
121
|
s.rubyforge_project = "backports"
|
123
|
-
s.rubygems_version = "1.8.
|
122
|
+
s.rubygems_version = "1.8.19"
|
124
123
|
s.summary = "Backports of Ruby 1.8.7+ for older ruby."
|
125
124
|
|
126
125
|
if s.respond_to? :specification_version then
|
data/lib/backports/1.8.7/argf.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
if RUBY_VERSION < '1.8.7'
|
2
|
-
class << ARGF
|
3
|
-
# No official documentation...
|
4
|
-
Backports.make_block_optional self, :each, :each_line, :each_byte
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
1
|
class << ARGF
|
9
2
|
# No official documentation...
|
3
|
+
|
4
|
+
if RUBY_VERSION < '1.8.7' # Can't test without block, as this hangs
|
5
|
+
Backports.make_block_optional self, :each, :each_line, :each_byte, :force => true
|
6
|
+
end
|
7
|
+
|
10
8
|
def each_char
|
11
9
|
return to_enum(:each_char) unless block_given?
|
12
10
|
if $KCODE == "UTF-8"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class Integer
|
2
|
-
Backports.make_block_optional self, :downto, :
|
2
|
+
Backports.make_block_optional self, :downto, :upto, :test_on => 42, :arg => 42
|
3
|
+
Backports.make_block_optional self, :times, :test_on => 42
|
3
4
|
|
4
5
|
# Standard in ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Fixnum.html]
|
5
6
|
def even?
|
data/lib/backports/1.8.7/io.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
class IO
|
2
2
|
if RUBY_VERSION < '1.8.7'
|
3
|
-
Backports.make_block_optional self, :each, :each_line, :each_byte
|
3
|
+
Backports.make_block_optional self, :each, :each_line, :each_byte, :force => true
|
4
4
|
class << self
|
5
|
-
Backports.make_block_optional self, :foreach
|
5
|
+
Backports.make_block_optional self, :foreach, :force => true
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
data/lib/backports/tools.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# Methods used internally by the backports.
|
2
|
-
|
3
2
|
module Backports
|
4
3
|
# Adapted from Pragmatic's "Programming Ruby" (since their version was buggy...)
|
5
4
|
def self.require_relative(relative_feature)
|
@@ -88,11 +87,16 @@ module Backports
|
|
88
87
|
warn "#{mod}##{selector} is not defined, so block can't be made optional"
|
89
88
|
next
|
90
89
|
end
|
91
|
-
unless options
|
92
|
-
|
93
|
-
|
90
|
+
unless options[:force]
|
91
|
+
# Check if needed
|
92
|
+
test_on = options.fetch(:test_on)
|
93
|
+
result = begin
|
94
|
+
test_on.send(selector, *options.fetch(:arg, []))
|
95
|
+
rescue LocalJumpError
|
96
|
+
false
|
97
|
+
end
|
98
|
+
next if result.class.name =~ /Enumerator$/
|
94
99
|
end
|
95
|
-
|
96
100
|
arity = mod.instance_method(selector).arity
|
97
101
|
last_arg = []
|
98
102
|
if arity < 0
|
metadata
CHANGED
@@ -1,35 +1,28 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: backports
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.5.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 5
|
9
|
-
- 1
|
10
|
-
version: 2.5.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
7
|
+
authors:
|
8
|
+
- Marc-André Lafortune
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-03-30 00:00:00 Z
|
12
|
+
date: 2012-05-07 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
14
|
+
description: ! ' Essential backports that enable some of the really nice features
|
15
|
+
of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.
|
20
16
|
|
21
|
-
|
17
|
+
'
|
22
18
|
email: github@marc-andre.ca
|
23
19
|
executables: []
|
24
|
-
|
25
20
|
extensions: []
|
26
|
-
|
27
|
-
extra_rdoc_files:
|
21
|
+
extra_rdoc_files:
|
28
22
|
- LICENSE
|
29
23
|
- README.rdoc
|
30
|
-
files:
|
24
|
+
files:
|
31
25
|
- .document
|
32
|
-
- .gitignore
|
33
26
|
- .irbrc
|
34
27
|
- CHANGELOG.rdoc
|
35
28
|
- LICENSE
|
@@ -128,42 +121,32 @@ files:
|
|
128
121
|
- test/README
|
129
122
|
homepage: http://github.com/marcandre/backports
|
130
123
|
licenses: []
|
131
|
-
|
132
124
|
post_install_message:
|
133
|
-
rdoc_options:
|
134
|
-
- --charset=UTF-8
|
125
|
+
rdoc_options:
|
135
126
|
- --title
|
136
127
|
- Backports library
|
137
128
|
- --main
|
138
129
|
- README.rdoc
|
139
130
|
- --line-numbers
|
140
131
|
- --inline-source
|
141
|
-
require_paths:
|
132
|
+
require_paths:
|
142
133
|
- lib
|
143
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
135
|
none: false
|
145
|
-
requirements:
|
146
|
-
- -
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
|
149
|
-
|
150
|
-
- 0
|
151
|
-
version: "0"
|
152
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
141
|
none: false
|
154
|
-
requirements:
|
155
|
-
- -
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
version: "0"
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
161
146
|
requirements: []
|
162
|
-
|
163
147
|
rubyforge_project: backports
|
164
|
-
rubygems_version: 1.8.
|
148
|
+
rubygems_version: 1.8.19
|
165
149
|
signing_key:
|
166
150
|
specification_version: 3
|
167
151
|
summary: Backports of Ruby 1.8.7+ for older ruby.
|
168
152
|
test_files: []
|
169
|
-
|