Skip to content

Instantly share code, notes, and snippets.

View kronos's full-sized avatar
👨‍💻

Ivan Samsonov kronos

👨‍💻
View GitHub Profile
diff --git a/kernel/common/array.rb b/kernel/common/array.rb
index edc1f92..06b3fe8 100644
--- a/kernel/common/array.rb
+++ b/kernel/common/array.rb
@@ -195,8 +195,9 @@ class Array
reg_length = @total - reg_start
if reg_start <= @total
- @tuple.copy_from @tuple, reg_start, reg_length, index
+ @tuple.copy_from @tuple, reg_start + @start, reg_length, index
diff --git a/kernel/common/array.rb b/kernel/common/array.rb
index 06b3fe8..d8c860f 100644
--- a/kernel/common/array.rb
+++ b/kernel/common/array.rb
@@ -819,13 +819,14 @@ class Array
# is constructed by calling #inspect on all elements.
# Descends through contained Arrays, recursive ones
# are indicated as [...].
- def inspect()
- out = []
diff --git a/spec/ruby/core/array/cycle_spec.rb b/spec/ruby/core/array/cycle_spec.rb
index fd1e0f2..491e177 100644
--- a/spec/ruby/core/array/cycle_spec.rb
+++ b/spec/ruby/core/array/cycle_spec.rb
@@ -17,5 +17,13 @@ describe "Enumerable#cycle" do
end.should == 42
bomb.should == 0
end
+
+ it "yields successive elements of the array repeatedly" do
diff --git a/spec/ruby/core/enumerable/cycle_spec.rb b/spec/ruby/core/enumerable/cycle_spec.rb
index 04705cd..1404c96 100644
--- a/spec/ruby/core/enumerable/cycle_spec.rb
+++ b/spec/ruby/core/enumerable/cycle_spec.rb
@@ -15,6 +15,15 @@ describe "Enumerable#cycle" do
end
end
+ it "yields successive elements of the array repeatedly" do
+ b = []
diff --git a/kernel/common/regexp.rb b/kernel/common/regexp.rb
index a779e4f..15a12b0 100644
--- a/kernel/common/regexp.rb
+++ b/kernel/common/regexp.rb
@@ -639,7 +639,14 @@ class MatchData
end
def inspect
- "#<MatchData:0x#{object_id.to_s(16)} \"#{matched_area}\">"
+ capts = captures
diff --git a/kernel/common/array.rb b/kernel/common/array.rb
index 39bfde2..a66ac71 100644
--- a/kernel/common/array.rb
+++ b/kernel/common/array.rb
@@ -743,8 +743,11 @@ class Array
hash_val = size
return size if Thread.detect_outermost_recursion self do
i = to_iter
+ mask = Fixnum::MAX >> 1
while i.next
// Ruby.primitive :array_hash
Fixnum* array_hash(STATE, Array* other) {
size_t hash = this->size();
for (size_t idx = 0; idx < other->size(); idx++) {
hash = (hash << 1) | (hash < 0 ? 1 : 0);
hash ^= as<Fixnum>(other->get(state, idx)).to_long();
}
return Fixnum::from(this->size());
}
diff --git a/spec/ruby/core/array/hash_spec.rb b/spec/ruby/core/array/hash_spec.rb
index d20a591..7c7257c 100644
--- a/spec/ruby/core/array/hash_spec.rb
+++ b/spec/ruby/core/array/hash_spec.rb
@@ -11,6 +11,12 @@ describe "Array#hash" do
end
end
+ it "returns different value for arrays with the same content in different order" do
+ [1, 2].hash.should_not == [2, 1].hash
diff --git a/spec/ruby/language/defined_spec.rb b/spec/ruby/language/defined_spec.rb
index 66cfdfd..c9cdfd7 100644
--- a/spec/ruby/language/defined_spec.rb
+++ b/spec/ruby/language/defined_spec.rb
@@ -39,6 +39,10 @@ describe "The defined? keyword when called with a method name" do
defined?(Kernel.puts).should == "method"
end
+ it "returns nil if method is private" do
+ defined?(Object.print).should be_nil
From aae49a96ebadc965c06b1de877c29548c7c67168 Mon Sep 17 00:00:00 2001
From: Ivan Samsonov <[email protected]>
Date: Fri, 19 Mar 2010 00:46:47 +0300
Subject: [PATCH] Since rubinius use native threads we should require 'timeout' instead of using systimer
---
lib/memcache.rb | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/memcache.rb b/lib/memcache.rb