backports 3.4.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/Gemfile.lock +1 -1
  2. data/README.rdoc +72 -115
  3. data/Rakefile +1 -2
  4. data/lib/backports/1.8.8.rb +2 -1
  5. data/lib/backports/1.9.1/array/sample.rb +16 -3
  6. data/lib/backports/1.9.1/file/open.rb +5 -3
  7. data/lib/backports/tools.rb +20 -5
  8. data/lib/backports/version.rb +1 -1
  9. data/set_version/2.1.0.rb +1 -0
  10. data/spec/tags/1.8.6/core/argf/each_line_spec.rb +6 -0
  11. data/spec/tags/1.8.6/core/argf/each_spec.rb +6 -0
  12. data/spec/tags/1.8.6/core/argf/lines_spec.rb +6 -0
  13. data/spec/tags/1.8.6/core/array/collect_spec.rb +7 -0
  14. data/spec/tags/1.8.6/core/file/open_spec.rb +3 -0
  15. data/spec/tags/1.8.6/core/hash/constructor_spec.rb +3 -0
  16. data/spec/tags/1.8.6/core/hash/default_proc_spec.rb +1 -0
  17. data/spec/tags/1.8.6/core/hash/delete_if_spec.rb +1 -0
  18. data/spec/tags/1.8.6/core/hash/each_pair_spec.rb +1 -0
  19. data/spec/tags/1.8.6/core/hash/keep_if_spec.rb +1 -0
  20. data/spec/tags/1.8.6/core/hash/rassoc_spec.rb +1 -0
  21. data/spec/tags/1.8.6/core/hash/reject_spec.rb +2 -0
  22. data/spec/tags/1.8.6/core/hash/select_spec.rb +7 -0
  23. data/spec/tags/1.8.6/core/integer/round_spec.rb +1 -0
  24. data/spec/tags/1.8.6/core/io/write_spec.rb +2 -0
  25. data/spec/tags/1.8.6/core/kernel/__callee___spec.rb +1 -0
  26. data/spec/tags/1.8.6/core/kernel/require_relative_spec.rb +3 -0
  27. data/spec/tags/1.8.6/core/math/log2_spec.rb +2 -0
  28. data/spec/tags/1.8.6/core/symbol/element_reference_spec.rb +2 -0
  29. data/spec/tags/1.8.6/core/symbol/to_proc_spec.rb +1 -0
  30. data/spec/tags/1.8.7/core/file/open_spec.rb +4 -0
  31. data/spec/tags/1.8.7/core/hash/default_proc_spec.rb +1 -0
  32. data/spec/tags/1.8.7/core/hash/keep_if_spec.rb +1 -0
  33. data/spec/tags/1.8.7/core/integer/round_spec.rb +1 -0
  34. data/spec/tags/1.8.7/core/io/open_spec.rb +7 -0
  35. data/spec/tags/1.8.7/core/io/write_spec.rb +2 -0
  36. data/spec/tags/1.8.7/core/kernel/__callee___spec.rb +1 -0
  37. data/spec/tags/1.8.7/core/kernel/require_relative_spec.rb +3 -0
  38. data/spec/tags/1.8.7/core/math/log2_spec.rb +2 -0
  39. data/spec/tags/1.8.7/core/range/size_spec.rb +1 -0
  40. data/spec/tags/1.8.7/core/symbol/element_reference_spec.rb +2 -0
  41. data/spec/tags/1.9.2/core/io/write_spec.rb +1 -0
  42. metadata +36 -7
  43. checksums.yaml +0 -7
@@ -7,7 +7,7 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- backports (3.3.5)
10
+ backports (3.4.1)
11
11
 
12
12
  GEM
13
13
  remote: http://rubygems.org/
@@ -34,9 +34,9 @@ Let's be a bit more precise about the "breaking code" business. It is of course
34
34
 
35
35
  A real incompatibility is, for example, <tt>Module::instance_methods</tt> which returns strings in 1.8 and symbols in 1.9. No change can be made without the risk of breaking existing code. Such incompatibilities are left unchanged, although you can require some of these changes in addition (see below)
36
36
 
37
- All features of 1.8.7 are backported (well, almost all, see the exception list bellow), and many of 1.9 are also. Some features of 2.0.0 are backported too.
37
+ All features of 1.8.7 are backported (well, almost all, see the exception list bellow), and many of the following versions up to 2.1
38
38
 
39
- Some generic and self-contained features of active-support are also included. By simple I mean that String#camelcase is there, but #pluralize isn't.
39
+ For historical reasons, some generic and self-contained features of active-support are also included. By simple I mean that String#camelcase is there, but #pluralize isn't. These will probably be removed in the future, so it's recommended to require those directly from active_support.
40
40
 
41
41
  == Installation & compatibility
42
42
 
@@ -65,26 +65,78 @@ With bundler, add to your Gemfile:
65
65
 
66
66
  Run <tt>bundle install</tt> and require the desired backports.
67
67
 
68
- Compatible with Ruby 1.8.6, 1.8.7, 1.9.1, 1.9.2, 1.9.3, 2.0.0, JRuby and Rubinius.
68
+ Compatible with Ruby 1.8.6, 1.8.7, 1.9.1, 1.9.2, 1.9.3, 2.0, 2.1, JRuby and Rubinius.
69
69
 
70
70
  = Complete List of backports
71
71
 
72
- == Ruby 1.8.7
72
+ == Ruby 2.1 backports
73
73
 
74
- Complete Ruby 1.8.7 backporting (core language). Refer to the official list of changes[https://github.com/ruby/ruby/blob/ruby_1_8_7/NEWS]. That's about 130 backports!
74
+ * Array
75
+ * +to_h+
76
+ * Enumerable
77
+ * +to_h+
75
78
 
76
- Only exceptions:
77
- * String#gsub (the form returning an enumerator)
78
- * GC.stress= (not implemented)
79
- * Array#choice (removed in 1.9, use 1.9.1's Array#sample instead)
79
+ == Ruby 2.0 backports
80
80
 
81
- To include _only_ these backports, <tt>require "backports/1.8.7"</tt>
81
+ * Array
82
+ * +bsearch+
83
+ * Enumerable
84
+ * +lazy+
85
+ * Enumerator::Lazy
86
+ * all methods
87
+ * Hash
88
+ * <tt>default_proc=</tt> (with nil argument)
89
+ * +to_h+
90
+ * nil.to_h
91
+ * Range
92
+ * +bsearch+
93
+ * Struct
94
+ * +to_h+
82
95
 
83
- == Ruby 1.8.8
96
+ == Ruby 1.9.3 backports
84
97
 
85
- Ruby 1.8.8 has been officially cancelled. As of version 2.2, <tt>require "backports/1.8.8"</tt> does nothing.
98
+ * File
99
+ * +NULL+
100
+ * IO
101
+ * +advise+ (acts as a noop)
102
+ * +write+, +binwrite+
103
+ * String
104
+ * +byteslice+
105
+ * +prepend+
86
106
 
87
- == Ruby 1.9.1
107
+ == Ruby 1.9.2 backports
108
+
109
+ * Array
110
+ * <tt>rotate, rotate!</tt>
111
+ * <tt>keep_if, select!</tt>
112
+ * +product+ (with block)
113
+ * +repeated_combination+, +repeated_permutation+
114
+ * <tt>sort_by!</tt>
115
+ * <tt>uniq, uniq!</tt> (with block)
116
+
117
+ * Complex
118
+ * +to_r+
119
+
120
+ * Dir
121
+ * +home+
122
+
123
+ * Enumerable
124
+ * +chunk+
125
+ * +flat_map+, +collect_concat+
126
+ * +join+
127
+ * +slice_before+
128
+
129
+ * Float::INFINITY, NAN
130
+
131
+ * Hash
132
+ * +keep_if+, <tt>select!</tt>
133
+
134
+ * Object
135
+ * <tt>singleton_class</tt>
136
+
137
+ * Random (new class)
138
+
139
+ == Ruby 1.9.1 backports
88
140
 
89
141
  Additionally, the following Ruby 1.9 features have been backported:
90
142
  * Array
@@ -168,110 +220,14 @@ but since it is only an imitation, it must be required explicitly:
168
220
 
169
221
  require 'backports/basic_object'
170
222
 
171
- == Ruby 1.9.2
172
-
173
- Finally, most of Ruby 1.9.2 features have been backported:
174
-
175
- * Array
176
- * <tt>rotate, rotate!</tt>
177
- * <tt>keep_if, select!</tt>
178
- * +product+ (with block)
179
- * +repeated_combination+, +repeated_permutation+
180
- * <tt>sort_by!</tt>
181
- * <tt>uniq, uniq!</tt> (with block)
182
-
183
- * Complex
184
- * +to_r+
185
-
186
- * Dir
187
- * +home+
188
-
189
- * Enumerable
190
- * +chunk+
191
- * +flat_map+, +collect_concat+
192
- * +join+
193
- * +slice_before+
194
-
195
- * Float::INFINITY, NAN
196
-
197
- * Hash
198
- * +keep_if+, <tt>select!</tt>
199
-
200
- * Object
201
- * <tt>singleton_class</tt>
202
-
203
- * Random (new class)
204
-
205
- To include _only_ these backports and earlier, <tt>require "backports/1.9.2"</tt>
206
-
207
- == Ruby 1.9.3
208
-
209
- Some features of Ruby 1.9.3 have been backported:
210
-
211
- * File
212
- * +NULL+
213
- * IO
214
- * +advise+ (acts as a noop)
215
- * +write+, +binwrite+
216
- * String
217
- * +byteslice+
218
- * +prepend+
219
-
220
- To include all Ruby backports but not those of Ruby 2.0 or Rails, <tt>require "backports/1.9.3"</tt> (or "backports/1.9")
221
-
222
- == Ruby 2.0.0
223
-
224
- Some features of Ruby 2.0.0 have been backported:
225
-
226
- * Array
227
- * +bsearch+
228
- * Enumerable
229
- * +lazy+
230
- * Enumerator::Lazy
231
- * all methods
232
- * Hash
233
- * <tt>default_proc=</tt> (with nil argument)
234
- * +to_h+
235
- * nil.to_h
236
- * Range
237
- * +bsearch+
238
- * Struct
239
- * +to_h+
240
-
241
- To include all Ruby backports but not those of Rails, <tt>require "backports/2.0"</tt> (or "backports/2.0.0")
242
-
243
- == Ruby 2.1.0
244
-
245
- Some features of Ruby 2.1.0 have been backported:
246
-
247
- * Array
248
- * +to_h+
249
- * Enumerable
250
- * +to_h+
251
-
252
- == Rails
253
-
254
- Some generic methods from Rails methods have been copied:
255
-
256
- * Enumerable
257
- * +sum+
258
-
259
- * Hash
260
- * +symbolize_keys+, <tt>symbolize_keys!</tt>
261
- * +reverse_merge+, <tt>reverse_merge!</tt>
262
-
263
- * Module
264
- * +alias_method_chain+
265
-
266
- * Object
267
- * +try+
223
+ == Ruby 1.8.7
268
224
 
269
- * String
270
- * +camelize+, +underscore+
271
- * +dasherize+, +demodulize+
272
- * +constantize+
225
+ Complete Ruby 1.8.7 backporting (core language). Refer to the official list of changes[https://github.com/ruby/ruby/blob/ruby_1_8_7/NEWS]. That's about 130 backports!
273
226
 
274
- To include _only_ these Rails backports but not those of Ruby, <tt>require "backports/rails"</tt>.
227
+ Only exceptions:
228
+ * String#gsub (the form returning an enumerator)
229
+ * GC.stress= (not implemented)
230
+ * Array#choice (removed in 1.9, use 1.9.1's Array#sample instead)
275
231
 
276
232
  == Libraries
277
233
 
@@ -313,6 +269,7 @@ These must be imported in addition to the backports gem, for example:
313
269
  require "backports/force/hash_select"
314
270
  {}.select{} # => {}, even in Ruby 1.8
315
271
 
272
+
316
273
  == Thanks
317
274
 
318
275
  Thanks for the bug reports and patches, in particular the repeat offenders:
data/Rakefile CHANGED
@@ -100,8 +100,7 @@ def mspec_cmds(pattern, action='ci')
100
100
  -r ./set_version/#{version}
101
101
  #{deps}
102
102
  -r backports/#{version_path}
103
- -C spec
104
- rubyspec/core/#{path}_spec.rb
103
+ spec/rubyspec/core/#{path}_spec.rb
105
104
  ].join(' '), path
106
105
  end
107
106
  end
@@ -1,2 +1,3 @@
1
- # require this file to load all the backports up to Ruby 1.8.8
1
+ # Ruby 1.8.8 has been officially cancelled. As of version 2.2 of backports, <tt>require "backports/1.8.8"</tt>
2
+ # does nothing more than require 1.8.7 backports
2
3
  require 'backports/1.8.7'
@@ -2,14 +2,27 @@ unless Array.method_defined? :sample
2
2
  require 'backports/tools'
3
3
 
4
4
  class Array
5
- def sample(n = Backports::Undefined)
6
- return self[Kernel.rand(size)] if n == Backports::Undefined
5
+ def sample(n = Backports::Undefined, options = Backports::Undefined)
6
+ if options == Backports::Undefined && n.respond_to?(:to_hash)
7
+ n, options = options, n
8
+ end
9
+ rng = Backports.coerce_to_option(options, :random) unless options == Backports::Undefined
10
+ generator = if rng.respond_to? :rand
11
+ Proc.new do |nb|
12
+ r = Backports::coerce_to_int(rng.rand(nb))
13
+ raise RangeError, "random generator returned #{r} which is not in 0...#{nb}" if r < 0 || r >= nb
14
+ r
15
+ end
16
+ else
17
+ Kernel.method(:rand)
18
+ end
19
+ return self[generator.call(size)] if n == Backports::Undefined
7
20
  n = Backports.coerce_to_int(n)
8
21
  raise ArgumentError, "negative array size" if n < 0
9
22
  n = size if n > size
10
23
  result = Array.new(self)
11
24
  n.times do |i|
12
- r = i + Kernel.rand(size - i)
25
+ r = i + generator.call(size - i)
13
26
  result[i], result[r] = result[r], result[i]
14
27
  end
15
28
  result[n..size] = []
@@ -3,8 +3,8 @@ begin
3
3
  rescue TypeError
4
4
  require 'backports/tools'
5
5
 
6
- def open_with_options_hash(file, mode = nil, perm = Backports::Undefined, options = Backports::Undefined)
7
- mode, perm = Backports.combine_mode_perm_and_option(mode, perm, options)
6
+ def open_with_options_hash(file, mode = nil, perm_or_options = Backports::Undefined)
7
+ mode, perm = Backports.combine_mode_perm_and_option(mode, perm_or_options)
8
8
  perm ||= 0666 # Avoid error on Rubinius, see issue #52
9
9
  if block_given?
10
10
  open_without_options_hash(file, mode, perm){|f| yield f}
@@ -13,7 +13,9 @@ rescue TypeError
13
13
  end
14
14
  end
15
15
 
16
- Backports.alias_method_chain File, :open, :options_hash
16
+ class << File
17
+ Backports.alias_method_chain self, :open, :options_hash
18
+ end
17
19
  end
18
20
 
19
21
  if RUBY_VERSION < '1.9'
@@ -226,6 +226,19 @@ module Backports
226
226
  coerce_to(obj, String, :to_str)
227
227
  end
228
228
 
229
+ def self.coerce_to_hash(obj)
230
+ coerce_to(obj, Hash, :to_hash)
231
+ end
232
+
233
+ def self.coerce_to_options(obj, *options)
234
+ hash = coerce_to_hash(obj)
235
+ hash.values_at(*options)
236
+ end
237
+
238
+ def self.coerce_to_option(obj, option)
239
+ coerce_to_options(obj, option)[0]
240
+ end
241
+
229
242
  def self.is_array?(obj)
230
243
  coerce_to(obj, Array, :to_ary) if obj.respond_to? :to_ary
231
244
  end
@@ -263,9 +276,9 @@ module Backports
263
276
  # Used internally to combine {IO|File} options hash into mode (String or Integer)
264
277
  def self.combine_mode_and_option(mode = nil, options = Backports::Undefined)
265
278
  # Can't backport autoclose, {internal|external|}encoding
266
- mode, options = nil, mode if mode.respond_to?(:to_hash) and options == Backports::Undefined
279
+ mode, options = nil, mode if mode.respond_to?(:to_hash) && options == Backports::Undefined
267
280
  options = {} if options == nil || options == Backports::Undefined
268
- options = coerce_to(options, Hash, :to_hash)
281
+ options = coerce_to_hash(options)
269
282
  if mode && options[:mode]
270
283
  raise ArgumentError, "mode specified twice"
271
284
  end
@@ -290,10 +303,11 @@ module Backports
290
303
 
291
304
  # Used internally to combine {IO|File} options hash into mode (String or Integer) and perm
292
305
  def self.combine_mode_perm_and_option(mode = nil, perm = Backports::Undefined, options = Backports::Undefined)
293
- mode, options = nil, mode if mode.is_a?(Hash) and perm == Backports::Undefined
294
- perm, options = nil, perm if perm.is_a?(Hash) and options == Backports::Undefined
306
+ mode, options = nil, mode if mode.respond_to?(:to_hash) && perm == Backports::Undefined
307
+ perm, options = nil, perm if perm.respond_to?(:to_hash) && options == Backports::Undefined
295
308
  perm = nil if perm == Backports::Undefined
296
309
  options = {} if options == Backports::Undefined
310
+ options = coerce_to_hash(options)
297
311
  if perm && options[:perm]
298
312
  raise ArgumentError, "perm specified twice"
299
313
  end
@@ -301,8 +315,9 @@ module Backports
301
315
  end
302
316
 
303
317
  def self.write(binary, filename, string, offset, options)
304
- offset, options = nil, offset if Hash === offset and options == Backports::Undefined
318
+ offset, options = nil, offset if offset.respond_to?(:to_hash) && options == Backports::Undefined
305
319
  options = {} if options == Backports::Undefined
320
+ options = coerce_to_hash(options)
306
321
  File.open(filename, 'a+'){} if offset # insure existence
307
322
  options = {:mode => offset.nil? ? "w" : "r+"}.merge(options)
308
323
  args = options[:open_args] || [options]
@@ -1,3 +1,3 @@
1
1
  module Backports
2
- VERSION = "3.4.0" unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
2
+ VERSION = "3.4.1" unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
3
3
  end
@@ -0,0 +1 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/setter")
@@ -0,0 +1,6 @@
1
+ fails:ARGF.each_line is a public method
2
+ fails:ARGF.each_line requires multiple arguments
3
+ fails:ARGF.each_line reads each line of files
4
+ fails:ARGF.each_line returns self when passed a block
5
+ fails:ARGF.each_line returns an Enumerator when passed no block
6
+ fails:ARGF.each_line with a separator yields each separated section of all streams
@@ -0,0 +1,6 @@
1
+ fails:ARGF.each is a public method
2
+ fails:ARGF.each requires multiple arguments
3
+ fails:ARGF.each reads each line of files
4
+ fails:ARGF.each returns self when passed a block
5
+ fails:ARGF.each returns an Enumerator when passed no block
6
+ fails:ARGF.each with a separator yields each separated section of all streams
@@ -0,0 +1,6 @@
1
+ fails:ARGF.lines is a public method
2
+ fails:ARGF.lines requires multiple arguments
3
+ fails:ARGF.lines reads each line of files
4
+ fails:ARGF.lines returns self when passed a block
5
+ fails:ARGF.lines returns an Enumerator when passed no block
6
+ fails:ARGF.lines with a separator yields each separated section of all streams
@@ -0,0 +1,7 @@
1
+ fails:Array#collect returns an Enumerator when no block given
2
+ fails:Array#collect does not copy untrusted status
3
+ fails:Array#collect! keeps untrusted status
4
+ fails:Array#collect! when frozen raises a RuntimeError
5
+ fails:Array#collect! when frozen raises a RuntimeError when empty
6
+ fails:Array#collect! when frozen raises a RuntimeError when calling #each on the returned Enumerator
7
+ fails:Array#collect! when frozen raises a RuntimeError when calling #each on the returned Enumerator when empty
@@ -8,3 +8,6 @@ fails:File.open opens a file with a file descriptor d and a block
8
8
  fails:File.open raises a SystemCallError if passed an invalid Integer type
9
9
  fails:File.open raises an IOError when read in a block opened with File::RDONLY|File::APPEND mode
10
10
  fails:File.open raises an IOError if the file exists when open with File::RDONLY|File::APPEND
11
+ fails:File.open defaults external_encoding to ASCII-8BIT for binary modes
12
+ fails:File.open when passed a file descriptor opens a file
13
+ fails:File.open when passed a file descriptor opens a file when passed a block
@@ -0,0 +1,3 @@
1
+ fails:Hash.[] raises an ArgumentError for arrays of more than 2 elements
2
+ fails:Hash.[] raises an ArgumentError when passed a list of value-invalid-pairs in an array
3
+ fails:Hash.[] removes the default_proc
@@ -1,2 +1,3 @@
1
1
  fails:Hash#default_proc= raises an error if passed nil
2
2
  fails:Hash#default_proc= raises a TypeError if passed a lambda with an arity other than 2
3
+ fails:Hash#default_proc= raises a RuntimeError if self is frozen
@@ -0,0 +1 @@
1
+ fails:Hash#delete_if raises a RuntimeError if called on a frozen instance
@@ -0,0 +1 @@
1
+ fails:Hash#each_pair yields a [[key, value]] Array for each pair to a block expecting |*args|
@@ -1 +1,2 @@
1
1
  fails:Hash#keep_if raises an RuntimeError if called on a frozen instance
2
+ fails:Hash#keep_if raises a RuntimeError if called on a frozen instance
@@ -0,0 +1 @@
1
+ fails:Hash#rassoc only returns the first matching key-value pair
@@ -0,0 +1,2 @@
1
+ fails:Hash#reject! raises a RuntimeError if called on a frozen instance that is modified
2
+ fails:Hash#reject! raises a RuntimeError if called on a frozen instance that would not be modified
@@ -1 +1,8 @@
1
1
  fails:Hash#select returns a Hash of entries for which block is true
2
+ fails:Hash#select! is equivalent to keep_if if changes are made
3
+ fails:Hash#select! returns nil if no changes were made
4
+ fails:Hash#select! raises a RuntimeError if called on an empty frozen instance
5
+ fails:Hash#select! raises a RuntimeError if called on a frozen instance that would not be modified
6
+ fails:Hash#select! returns an Enumerator if called on a non-empty hash without a block
7
+ fails:Hash#select! returns an Enumerator if called on an empty hash without a block
8
+ fails:Hash#select! returns an Enumerator if called on a frozen instance
@@ -1 +1,2 @@
1
1
  fails:Integer#round raises a RangeError when passed Float::INFINITY
2
+ fails:Integer#round raises a RangeError when passed a big negative value
@@ -1,3 +1,5 @@
1
1
  fails:IO.write uses encoding from given options, if provided
2
2
  fails:IO.write uses an :open_args option
3
3
  fails:IO.write disregards other options if :open_args is given
4
+ fails:IO.write uses the given encoding and returns the number of bytes written
5
+ fails:IO.write writes binary data if no encoding is given
@@ -3,3 +3,4 @@ fails:Kernel.__callee__ returns the original name when aliased method
3
3
  fails:Kernel.__callee__ returns the caller from blocks too
4
4
  fails:Kernel.__callee__ returns nil when not called from a method
5
5
  fails:Kernel.__callee__ returns the caller when sent as a string
6
+ fails:Kernel.__callee__ returns the aliased name when aliased method
@@ -0,0 +1,3 @@
1
+ fails:Kernel#require_relative with a relative path stores the missing path in a LoadError object
2
+ fails:Kernel#require_relative with a relative path when file is a symlink loads a path relative to current file
3
+ fails:Kernel#require_relative with an absolute path stores the missing path in a LoadError object
@@ -2,3 +2,5 @@ fails:Math.log2 raises an Errno::EDOM if the argument is less than 0
2
2
  fails:Math.log2 raises an TypeError if the argument cannot be coerced with Float()
3
3
  fails:Math.log2 raises an TypeError if passed a numerical argument as a string
4
4
  fails:Math.log2 returns NaN given NaN
5
+ fails:Math.log2 raises a TypeError if the argument cannot be coerced with Float()
6
+ fails:Math.log2 raises a TypeError if passed a numerical argument as a string
@@ -1,2 +1,4 @@
1
1
  fails:Symbol#[] with a Regex slice without a capture index sets $~ to the MatchData if there is a match
2
2
  fails:Symbol#[] with a Regex slice with a capture index sets $~ to the MatchData if there is a match
3
+ fails:Symbol#[] with a Regex slice without a capture index returns an untrusted string if the regexp is untrusted
4
+ fails:Symbol#[] with a Regex slice with a capture index returns an untrusted string if the regexp is untrusted
@@ -0,0 +1 @@
1
+ fails:Symbol#to_proc raises an ArgumentError when calling #call on the Proc without receiver
@@ -1 +1,5 @@
1
1
  fails:File.open on a FIFO opens it as a normal file
2
+ fails:File.open raises a SystemCallError if passed an invalid Integer type
3
+ fails:File.open defaults external_encoding to ASCII-8BIT for binary modes
4
+ fails:File.open when passed a file descriptor opens a file
5
+ fails:File.open when passed a file descriptor opens a file when passed a block
@@ -1,2 +1,3 @@
1
1
  fails:Hash#default_proc= raises an error if passed nil
2
2
  fails:Hash#default_proc= raises a TypeError if passed a lambda with an arity other than 2
3
+ fails:Hash#default_proc= raises a RuntimeError if self is frozen
@@ -1 +1,2 @@
1
1
  fails:Hash#keep_if raises an RuntimeError if called on a frozen instance
2
+ fails:Hash#keep_if raises a RuntimeError if called on a frozen instance
@@ -1 +1,2 @@
1
1
  fails:Integer#round raises a RangeError when passed Float::INFINITY
2
+ fails:Integer#round raises a RangeError when passed a big negative value
@@ -23,3 +23,10 @@ fails:IO.open coerces options as second argument with #to_hash
23
23
  fails:IO.open raises ArgumentError if not passed a hash or nil for options
24
24
  fails:IO.open sets external encoding to binary with :binmode option
25
25
  fails:IO.open raises an error if passed binary/text mode two ways
26
+ fails:IO.open uses the :encoding option as the external encoding when only one is given
27
+ fails:IO.open uses the :encoding options as the external encoding when it's an Encoding object
28
+ fails:IO.open coerces :encoding option with #to_str
29
+ fails:IO.open coerces :external_encoding option with #to_str
30
+ fails:IO.open coerces :internal_encoding option with #to_str
31
+ fails:IO.open accepts an :autoclose option
32
+ fails:IO.open accepts any truthy option :autoclose
@@ -1,3 +1,5 @@
1
1
  fails:IO.write uses encoding from given options, if provided
2
2
  fails:IO.write uses an :open_args option
3
3
  fails:IO.write disregards other options if :open_args is given
4
+ fails:IO.write uses the given encoding and returns the number of bytes written
5
+ fails:IO.write writes binary data if no encoding is given
@@ -3,3 +3,4 @@ fails:Kernel.__callee__ returns the original name when aliased method
3
3
  fails:Kernel.__callee__ returns the caller from blocks too
4
4
  fails:Kernel.__callee__ returns nil when not called from a method
5
5
  fails:Kernel.__callee__ returns the caller when sent as a string
6
+ fails:Kernel.__callee__ returns the aliased name when aliased method
@@ -0,0 +1,3 @@
1
+ fails:Kernel#require_relative with a relative path stores the missing path in a LoadError object
2
+ fails:Kernel#require_relative with a relative path when file is a symlink loads a path relative to current file
3
+ fails:Kernel#require_relative with an absolute path stores the missing path in a LoadError object
@@ -2,3 +2,5 @@ fails:Math.log2 raises an Errno::EDOM if the argument is less than 0
2
2
  fails:Math.log2 raises an TypeError if the argument cannot be coerced with Float()
3
3
  fails:Math.log2 raises an TypeError if passed a numerical argument as a string
4
4
  fails:Math.log2 returns NaN given NaN
5
+ fails:Math.log2 raises a TypeError if the argument cannot be coerced with Float()
6
+ fails:Math.log2 raises a TypeError if passed a numerical argument as a string
@@ -0,0 +1 @@
1
+ fails:Range#size returns nil if first and last are not Numeric
@@ -1,2 +1,4 @@
1
1
  fails:Symbol#[] with a Regex slice without a capture index sets $~ to the MatchData if there is a match
2
2
  fails:Symbol#[] with a Regex slice with a capture index sets $~ to the MatchData if there is a match
3
+ fails:Symbol#[] with a Regex slice without a capture index returns an untrusted string if the regexp is untrusted
4
+ fails:Symbol#[] with a Regex slice with a capture index returns an untrusted string if the regexp is untrusted
@@ -1,2 +1,3 @@
1
1
  fails:IO.write uses encoding from given options, if provided
2
2
  fails:IO.write uses an :open_args option
3
+ fails:IO.write uses the given encoding and returns the number of bytes written
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backports
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Marc-André Lafortune
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-12-29 00:00:00.000000000 Z
12
+ date: 2014-01-31 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: Essential backports that enable many of the nice features of Ruby 1.8.7
14
15
  up to 2.0.0 for earlier versions.
@@ -416,7 +417,12 @@ files:
416
417
  - set_version/1.9.2.rb
417
418
  - set_version/1.9.3.rb
418
419
  - set_version/2.0.0.rb
420
+ - set_version/2.1.0.rb
419
421
  - set_version/setter.rb
422
+ - spec/tags/1.8.6/core/argf/each_line_spec.rb
423
+ - spec/tags/1.8.6/core/argf/each_spec.rb
424
+ - spec/tags/1.8.6/core/argf/lines_spec.rb
425
+ - spec/tags/1.8.6/core/array/collect_spec.rb
420
426
  - spec/tags/1.8.6/core/array/rotate_spec.rb
421
427
  - spec/tags/1.8.6/core/array/uniq_spec.rb
422
428
  - spec/tags/1.8.6/core/complex/to_r_spec.rb
@@ -431,10 +437,15 @@ files:
431
437
  - spec/tags/1.8.6/core/fixnum/fdiv_spec.rb
432
438
  - spec/tags/1.8.6/core/gc/stress_spec.rb
433
439
  - spec/tags/1.8.6/core/hash/assoc_spec.rb
440
+ - spec/tags/1.8.6/core/hash/constructor_spec.rb
434
441
  - spec/tags/1.8.6/core/hash/default_proc_spec.rb
442
+ - spec/tags/1.8.6/core/hash/delete_if_spec.rb
443
+ - spec/tags/1.8.6/core/hash/each_pair_spec.rb
435
444
  - spec/tags/1.8.6/core/hash/eql_spec.rb
436
445
  - spec/tags/1.8.6/core/hash/hash_spec.rb
437
446
  - spec/tags/1.8.6/core/hash/keep_if_spec.rb
447
+ - spec/tags/1.8.6/core/hash/rassoc_spec.rb
448
+ - spec/tags/1.8.6/core/hash/reject_spec.rb
438
449
  - spec/tags/1.8.6/core/hash/select_spec.rb
439
450
  - spec/tags/1.8.6/core/integer/round_spec.rb
440
451
  - spec/tags/1.8.6/core/io/binread_spec.rb
@@ -448,6 +459,7 @@ files:
448
459
  - spec/tags/1.8.6/core/kernel/__method___spec.rb
449
460
  - spec/tags/1.8.6/core/kernel/define_singleton_method_spec.rb
450
461
  - spec/tags/1.8.6/core/kernel/public_method_spec.rb
462
+ - spec/tags/1.8.6/core/kernel/require_relative_spec.rb
451
463
  - spec/tags/1.8.6/core/math/log2_spec.rb
452
464
  - spec/tags/1.8.6/core/math/log_spec.rb
453
465
  - spec/tags/1.8.6/core/module/class_exec_spec.rb
@@ -468,6 +480,7 @@ files:
468
480
  - spec/tags/1.8.6/core/symbol/empty_spec.rb
469
481
  - spec/tags/1.8.6/core/symbol/match_spec.rb
470
482
  - spec/tags/1.8.6/core/symbol/swapcase_spec.rb
483
+ - spec/tags/1.8.6/core/symbol/to_proc_spec.rb
471
484
  - spec/tags/1.8.6/core/symbol/upcase_spec.rb
472
485
  - spec/tags/1.8.7/core/array/keep_if_spec.rb
473
486
  - spec/tags/1.8.7/core/array/rotate_spec.rb
@@ -493,10 +506,12 @@ files:
493
506
  - spec/tags/1.8.7/core/kernel/__callee___spec.rb
494
507
  - spec/tags/1.8.7/core/kernel/define_singleton_method_spec.rb
495
508
  - spec/tags/1.8.7/core/kernel/public_method_spec.rb
509
+ - spec/tags/1.8.7/core/kernel/require_relative_spec.rb
496
510
  - spec/tags/1.8.7/core/math/log2_spec.rb
497
511
  - spec/tags/1.8.7/core/math/log_spec.rb
498
512
  - spec/tags/1.8.7/core/proc/curry_spec.rb
499
513
  - spec/tags/1.8.7/core/proc/yield_spec.rb
514
+ - spec/tags/1.8.7/core/range/size_spec.rb
500
515
  - spec/tags/1.8.7/core/string/getbyte_spec.rb
501
516
  - spec/tags/1.8.7/core/string/prepend_spec.rb
502
517
  - spec/tags/1.8.7/core/string/setbyte_spec.rb
@@ -520,28 +535,33 @@ files:
520
535
  - test/test_helper.rb
521
536
  homepage: http://github.com/marcandre/backports
522
537
  licenses: []
523
- metadata: {}
524
538
  post_install_message:
525
539
  rdoc_options: []
526
540
  require_paths:
527
541
  - lib
528
542
  required_ruby_version: !ruby/object:Gem::Requirement
543
+ none: false
529
544
  requirements:
530
- - - '>='
545
+ - - ! '>='
531
546
  - !ruby/object:Gem::Version
532
547
  version: '0'
533
548
  required_rubygems_version: !ruby/object:Gem::Requirement
549
+ none: false
534
550
  requirements:
535
- - - '>='
551
+ - - ! '>='
536
552
  - !ruby/object:Gem::Version
537
553
  version: '0'
538
554
  requirements: []
539
555
  rubyforge_project:
540
- rubygems_version: 2.0.3
556
+ rubygems_version: 1.8.24
541
557
  signing_key:
542
- specification_version: 4
558
+ specification_version: 3
543
559
  summary: Backports of Ruby features for older Ruby.
544
560
  test_files:
561
+ - spec/tags/1.8.6/core/argf/each_line_spec.rb
562
+ - spec/tags/1.8.6/core/argf/each_spec.rb
563
+ - spec/tags/1.8.6/core/argf/lines_spec.rb
564
+ - spec/tags/1.8.6/core/array/collect_spec.rb
545
565
  - spec/tags/1.8.6/core/array/rotate_spec.rb
546
566
  - spec/tags/1.8.6/core/array/uniq_spec.rb
547
567
  - spec/tags/1.8.6/core/complex/to_r_spec.rb
@@ -556,10 +576,15 @@ test_files:
556
576
  - spec/tags/1.8.6/core/fixnum/fdiv_spec.rb
557
577
  - spec/tags/1.8.6/core/gc/stress_spec.rb
558
578
  - spec/tags/1.8.6/core/hash/assoc_spec.rb
579
+ - spec/tags/1.8.6/core/hash/constructor_spec.rb
559
580
  - spec/tags/1.8.6/core/hash/default_proc_spec.rb
581
+ - spec/tags/1.8.6/core/hash/delete_if_spec.rb
582
+ - spec/tags/1.8.6/core/hash/each_pair_spec.rb
560
583
  - spec/tags/1.8.6/core/hash/eql_spec.rb
561
584
  - spec/tags/1.8.6/core/hash/hash_spec.rb
562
585
  - spec/tags/1.8.6/core/hash/keep_if_spec.rb
586
+ - spec/tags/1.8.6/core/hash/rassoc_spec.rb
587
+ - spec/tags/1.8.6/core/hash/reject_spec.rb
563
588
  - spec/tags/1.8.6/core/hash/select_spec.rb
564
589
  - spec/tags/1.8.6/core/integer/round_spec.rb
565
590
  - spec/tags/1.8.6/core/io/binread_spec.rb
@@ -573,6 +598,7 @@ test_files:
573
598
  - spec/tags/1.8.6/core/kernel/__method___spec.rb
574
599
  - spec/tags/1.8.6/core/kernel/define_singleton_method_spec.rb
575
600
  - spec/tags/1.8.6/core/kernel/public_method_spec.rb
601
+ - spec/tags/1.8.6/core/kernel/require_relative_spec.rb
576
602
  - spec/tags/1.8.6/core/math/log2_spec.rb
577
603
  - spec/tags/1.8.6/core/math/log_spec.rb
578
604
  - spec/tags/1.8.6/core/module/class_exec_spec.rb
@@ -593,6 +619,7 @@ test_files:
593
619
  - spec/tags/1.8.6/core/symbol/empty_spec.rb
594
620
  - spec/tags/1.8.6/core/symbol/match_spec.rb
595
621
  - spec/tags/1.8.6/core/symbol/swapcase_spec.rb
622
+ - spec/tags/1.8.6/core/symbol/to_proc_spec.rb
596
623
  - spec/tags/1.8.6/core/symbol/upcase_spec.rb
597
624
  - spec/tags/1.8.7/core/array/keep_if_spec.rb
598
625
  - spec/tags/1.8.7/core/array/rotate_spec.rb
@@ -618,10 +645,12 @@ test_files:
618
645
  - spec/tags/1.8.7/core/kernel/__callee___spec.rb
619
646
  - spec/tags/1.8.7/core/kernel/define_singleton_method_spec.rb
620
647
  - spec/tags/1.8.7/core/kernel/public_method_spec.rb
648
+ - spec/tags/1.8.7/core/kernel/require_relative_spec.rb
621
649
  - spec/tags/1.8.7/core/math/log2_spec.rb
622
650
  - spec/tags/1.8.7/core/math/log_spec.rb
623
651
  - spec/tags/1.8.7/core/proc/curry_spec.rb
624
652
  - spec/tags/1.8.7/core/proc/yield_spec.rb
653
+ - spec/tags/1.8.7/core/range/size_spec.rb
625
654
  - spec/tags/1.8.7/core/string/getbyte_spec.rb
626
655
  - spec/tags/1.8.7/core/string/prepend_spec.rb
627
656
  - spec/tags/1.8.7/core/string/setbyte_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 7da093a04f20685d90b76d07f7398d4decfc2469
4
- data.tar.gz: d64740047dfc70000974538b0a330bd1ffc79483
5
- SHA512:
6
- metadata.gz: 16c0b340e43e79bc6215c22a5943495f63cb7e4961aad2c15bd2120d68dcf0c30868277e49a105c8728e269d125a9eb0194ec23ba5764aa5d64d3d1cc1f96db9
7
- data.tar.gz: 1175d551ee9fb1d2efef7e033a09c04bed75423e5378092e5448c9fa9d3ece568f6f9e7ed9dd1c954de331b97f84867e97fadb09cb9d3e53be98b4e10a71c817