backports 1.10.3 → 1.11.0
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.
- data/CHANGELOG.rdoc +10 -0
- data/README.rdoc +7 -3
- data/Rakefile +4 -3
- data/VERSION.yml +2 -2
- data/backports.gemspec +2 -2
- data/lib/backports/1.8.7/kernel.rb +0 -7
- data/lib/backports/1.9/enumerable.rb +8 -0
- data/lib/backports/1.9/kernel.rb +31 -2
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= Packable --- History
|
2
2
|
|
3
|
+
== Version 1.11.0 - November 4th, 2009
|
4
|
+
|
5
|
+
* Added Enumerable#flat_map / collect_concat (Ruby 1.9)
|
6
|
+
|
7
|
+
* Added Object#public_send (Ruby 1.9)
|
8
|
+
|
9
|
+
* Added Object#public_method (Ruby 1.9)
|
10
|
+
|
11
|
+
* bug fixes
|
12
|
+
|
3
13
|
== Version 1.10.0 - September 29th, 2009
|
4
14
|
|
5
15
|
* Added Enumerable#chunk (Ruby 1.9)
|
data/README.rdoc
CHANGED
@@ -4,7 +4,7 @@ Would you like to use features of Ruby 1.8.7 without the need of having 1.8.7 in
|
|
4
4
|
|
5
5
|
require 'backports/1.8.7'
|
6
6
|
|
7
|
-
All 1.8.7 features are now available!
|
7
|
+
All 1.8.7 features are now available! Many of the features of 1.9 are also available with
|
8
8
|
|
9
9
|
require 'backports/1.9'
|
10
10
|
|
@@ -69,6 +69,7 @@ Additionally, the following Ruby 1.9 have been backported:
|
|
69
69
|
|
70
70
|
* Enumerator
|
71
71
|
* +new+ (with block)
|
72
|
+
* +flat_map+, +collect_concat+
|
72
73
|
|
73
74
|
* File
|
74
75
|
* +binread+
|
@@ -84,7 +85,9 @@ Additionally, the following Ruby 1.9 have been backported:
|
|
84
85
|
|
85
86
|
* Object
|
86
87
|
* +define_singleton_method+
|
87
|
-
* +
|
88
|
+
* +public_method+
|
89
|
+
* +public_send+
|
90
|
+
* <tt>respond_to_missing?</tt>
|
88
91
|
|
89
92
|
* Proc
|
90
93
|
* +yield+
|
@@ -98,7 +101,8 @@ Additionally, the following Ruby 1.9 have been backported:
|
|
98
101
|
|
99
102
|
+Enumerator+ can be accessed directly (instead of <tt>Enumerable::Enumerator</tt>)
|
100
103
|
|
101
|
-
Moreover, a pretty good imitation of BasicObject is available,
|
104
|
+
Moreover, a pretty good imitation of BasicObject is available,
|
105
|
+
but since it is only an imitation, it must be required explicitly:
|
102
106
|
|
103
107
|
require 'backports/basic_object'
|
104
108
|
|
data/Rakefile
CHANGED
@@ -22,9 +22,10 @@ begin
|
|
22
22
|
|
23
23
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
24
24
|
end
|
25
|
-
Jeweler::
|
26
|
-
|
27
|
-
|
25
|
+
Jeweler::GemcutterTasks.new
|
26
|
+
# Jeweler::RubyforgeTasks.new do |rubyforge|
|
27
|
+
# rubyforge.doc_task = "rdoc"
|
28
|
+
# end
|
28
29
|
rescue LoadError
|
29
30
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
30
31
|
end
|
data/VERSION.yml
CHANGED
data/backports.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{backports}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.11.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marc-Andr\303\251 Lafortune"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-11-04}
|
13
13
|
s.description = %q{ 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.
|
14
14
|
}
|
15
15
|
s.email = %q{github@marc-andre.ca}
|
@@ -5,13 +5,6 @@ module Kernel
|
|
5
5
|
m.to_sym if m
|
6
6
|
end unless (__method__ || true rescue false)
|
7
7
|
|
8
|
-
# Standard in ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
|
9
|
-
def define_singleton_method(*args, &block)
|
10
|
-
class << self
|
11
|
-
self
|
12
|
-
end.send(:define_method, *args, &block)
|
13
|
-
end unless method_defined? :define_singleton_method
|
14
|
-
|
15
8
|
# Standard in ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
|
16
9
|
def instance_exec(*arg, &block)
|
17
10
|
define_singleton_method(:"temporary method for instance_exec", &block)
|
@@ -6,6 +6,7 @@ module Enumerable
|
|
6
6
|
memo
|
7
7
|
end unless method_defined? :each_with_object
|
8
8
|
|
9
|
+
# Standard in Ruby 1.9.2 See official documentation[http://ruby-doc.org/core-1.9/classes/Enumerable.html]
|
9
10
|
def chunk(initial_state = nil, &original_block)
|
10
11
|
raise ArgumentError, "no block given" unless block_given?
|
11
12
|
::Enumerator.new do |yielder|
|
@@ -39,4 +40,11 @@ module Enumerable
|
|
39
40
|
yielder.yield [previous, accumulate] unless accumulate.empty?
|
40
41
|
end
|
41
42
|
end unless method_defined? :chunk
|
43
|
+
|
44
|
+
# Standard in Ruby 1.9.2 See official documentation[http://ruby-doc.org/core-1.9/classes/Enumerable.html]
|
45
|
+
def flat_map(&block)
|
46
|
+
return to_enum :flat_map unless block_given?
|
47
|
+
map(&block).flatten(1)
|
48
|
+
end unless method_defined? :flat_map
|
49
|
+
alias_method :collect_concat, :flat_map unless method_defined? :collect_concat
|
42
50
|
end
|
data/lib/backports/1.9/kernel.rb
CHANGED
@@ -1,11 +1,40 @@
|
|
1
1
|
module Kernel
|
2
2
|
alias_method :__callee__, :__method__ unless (__callee__ || true rescue false)
|
3
|
-
|
3
|
+
|
4
|
+
# Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
|
5
|
+
def define_singleton_method(*args, &block)
|
6
|
+
class << self
|
7
|
+
self
|
8
|
+
end.send(:define_method, *args, &block)
|
9
|
+
end unless method_defined? :define_singleton_method
|
10
|
+
|
11
|
+
# Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
|
4
12
|
def require_relative(relative_feature)
|
5
13
|
file = caller.first.split(/:\d/,2).first
|
6
14
|
if /\A\((.*)\)/ =~ file # eval, etc.
|
7
15
|
raise LoadError, "require_relative is called in #{$1}"
|
8
16
|
end
|
9
17
|
require File.expand_path(relative_feature, File.dirname(file))
|
10
|
-
end
|
18
|
+
end unless method_defined? :require_relative
|
19
|
+
private :require_relative
|
20
|
+
|
21
|
+
# Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
|
22
|
+
def public_method(meth)
|
23
|
+
if respond_to?(meth) && !protected_methods.include?(meth.to_s)
|
24
|
+
method(meth)
|
25
|
+
else
|
26
|
+
raise NameError, "undefined method `#{meth}' for class `#{self.class}'"
|
27
|
+
end
|
28
|
+
end unless method_defined? :public_method
|
29
|
+
|
30
|
+
# Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
|
31
|
+
def public_send(method, *args, &block)
|
32
|
+
if respond_to?(method) && !protected_methods.include?(method.to_s)
|
33
|
+
send(method, *args, &block)
|
34
|
+
else
|
35
|
+
:foo.generate_a_no_method_error_in_preparation_for_method_missing rescue nil
|
36
|
+
# otherwise a NameError might be raised when we call method_missing ourselves
|
37
|
+
method_missing(method.to_sym, *args, &block)
|
38
|
+
end
|
39
|
+
end unless method_defined? :public_send
|
11
40
|
end
|
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.
|
4
|
+
version: 1.11.0
|
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-
|
12
|
+
date: 2009-11-04 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|