backports 1.6.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 6
4
- :patch: 1
4
+ :patch: 3
@@ -7,7 +7,7 @@ class Enumerator
7
7
  raise StopIteration unless @generator.next?
8
8
  @generator.next
9
9
  end unless method_defined? :next
10
-
10
+
11
11
  def rewind
12
12
  require 'generator'
13
13
  @generator ||= Generator.new(self)
@@ -21,12 +21,12 @@ class Enumerator
21
21
  def initialize(&block)
22
22
  @main_block = block
23
23
  end
24
-
24
+
25
25
  def each(&block)
26
26
  @final_block = block
27
27
  @main_block.call(self)
28
28
  end
29
-
29
+
30
30
  def yield(*arg)
31
31
  @final_block.yield(*arg)
32
32
  end
@@ -21,7 +21,10 @@ class Module
21
21
  end
22
22
  end unless method_defined? :alias_method_chain
23
23
 
24
- alias_method :module_exec, :instance_exec unless method_defined? :module_exec
24
+ # Can't use alias_method here because of jruby (see http://jira.codehaus.org/browse/JRUBY-2435 )
25
+ def module_exec(*arg, &block)
26
+ instance_exec(*arg, &block)
27
+ end unless method_defined? :module_exec
25
28
  alias_method :class_exec, :module_exec unless method_defined? :class_exec
26
29
 
27
30
  # Metaprogramming utility to make block optional.
@@ -1,4 +1,6 @@
1
1
  require 'enumerator'
2
+ # Must be defined outside of Kernel for jruby, see http://jira.codehaus.org/browse/JRUBY-3609
3
+ Enumerator = Enumerable::Enumerator unless Kernel.const_defined? :Enumerator # Standard in ruby 1.9
2
4
 
3
5
  module Kernel # Did you know that object instance methods are defined in Kernel?
4
6
 
@@ -19,16 +21,17 @@ module Kernel # Did you know that object instance methods are defined in Kernel?
19
21
  obj
20
22
  end unless method_defined? :returning
21
23
 
22
- Enumerator = Enumerable::Enumerator unless const_defined? :Enumerator # Standard in ruby 1.9
23
-
24
+ # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
24
25
  def define_singleton_method(symbol, &block)
25
26
  class << self
26
27
  self
27
28
  end.send(:define_method, symbol, block)
28
29
  end unless method_defined? :define_singleton_method
29
30
 
31
+ # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
30
32
  def instance_exec(*arg, &block)
31
33
  define_singleton_method(:"temporary method for instance_exec", &block)
32
34
  send(:"temporary method for instance_exec", *arg)
33
35
  end unless method_defined? :instance_exec
36
+
34
37
  end
@@ -70,7 +70,7 @@ class String
70
70
 
71
71
  unless ("abc".gsub(/./) rescue false)
72
72
  def gsub_with_optional_block(*arg, &block)
73
- return to_enum(:gsub_with_optional_block, *arg) unless block_given? || arg.size > 1
73
+ return to_enum(:gsub_with_optional_block, *arg, &block) unless block_given? || arg.size > 1
74
74
  gsub_without_optional_block(*arg, &block)
75
75
  end
76
76
  alias_method_chain :gsub, :optional_block
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backports
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Marc-Andr\xC3\xA9 Lafortune"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-29 00:00:00 -04:00
12
+ date: 2009-04-30 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15