Skip to content

Commit

Permalink
Showing 6 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
@@ -163,7 +163,7 @@ class Configure
@vendored_libdir = File.join(root, "/vendor")

# Ruby compatibility version
@ruby_version = "2.2.0"
@ruby_version = "2.2.2"
@ruby_libversion = @ruby_version.split(/\./)[0..1].join.to_i

# Configure settings
5 changes: 2 additions & 3 deletions kernel/array.rb
Original file line number Diff line number Diff line change
@@ -1273,9 +1273,8 @@ def product(*args)
outer_lambda.call([])

if block_given?
block_result = self
result.each { |v| block_result << yield(v) }
block_result
result.each { |v| yield(v) }
self
else
result
end
6 changes: 6 additions & 0 deletions spec/ruby/core/array/product_spec.rb
Original file line number Diff line number Diff line change
@@ -41,6 +41,12 @@
acc.should be_empty
end

it "returns self" do
a = [1, 2, 3].freeze

a.product([1, 2]) { |p| p.first }.should == a
end

it "will ignore unreasonable numbers of products and yield anyway" do
a = (0..100).to_a
lambda do
6 changes: 6 additions & 0 deletions spec/ruby/language/fixtures/super.rb
Original file line number Diff line number Diff line change
@@ -340,5 +340,11 @@ def foo(**)
super
end
end

class C < A
def foo(a:, b: 'b', **)
super
end
end
end
end
6 changes: 6 additions & 0 deletions spec/ruby/language/super_spec.rb
Original file line number Diff line number Diff line change
@@ -166,6 +166,12 @@ def a(arg)
b.foo(:number => 10).should == {:number => 10}
end

it "passes any given keyword arguments including optional and required ones to the parent" do
c = Super::KeywordArguments::C.new

c.foo(a: 'a', c: 'c').should == {a: 'a', b: 'b', c: 'c'}
end

it 'does not pass any keyword arguments to the parent when none are given' do
b = Super::KeywordArguments::B.new

1 change: 1 addition & 0 deletions spec/tags/ruby/language/super_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fails:The super keyword raises a RuntimeError when called with implicit arguments from a method defined with define_method
fails:The super keyword invokes methods from a chain of anonymous modules
fails:The super keyword when using keyword arguments does not pass any keyword arguments to the parent when none are given
fails:The super keyword when using keyword arguments passes any given keyword arguments including optional and required ones to the parent

0 comments on commit 719f02c

Please sign in to comment.