Skip to content

Instantly share code, notes, and snippets.

View kronos's full-sized avatar
👨‍💻

Ivan Samsonov kronos

👨‍💻
View GitHub Profile
class X < Hash
attr_reader :x
def initialize
@x = nil
end
def some_method
@x = 2
end
end
diff --git a/kernel/common/hash.rb b/kernel/common/hash.rb
index fe7c1ff..b095c26 100644
--- a/kernel/common/hash.rb
+++ b/kernel/common/hash.rb
@@ -253,6 +253,7 @@ class Hash
def dup
hash = self.class.new
+ hash.copy_object self
hash.send :initialize_copy, self
irb(main):005:0> Object.not_a_method
NoMethodError: no method 'not_a_method' on Object (Class)
from Kernel(Class)#not_a_method (method_missing) at kernel/delta/kernel.rb:83
from (irb):5
irb(main):006:0> exit
kronos:rubinius kronos$ rvm use 1.8.7
Now using ruby 1.8.7 p248
kronos:rubinius kronos$ irb
From 3869db5ed39a82048131b381993860d4357941b4 Mon Sep 17 00:00:00 2001
From: Ivan Samsonov <[email protected]>
Date: Mon, 22 Mar 2010 08:32:54 +0300
Subject: [PATCH] Doesn't undef method __metaclass__ because we need it on rubinius
---
lib/sequel/sql.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/sequel/sql.rb b/lib/sequel/sql.rb
it "return the basename for edge cases" do
File.basename("").should == ""
File.basename(".").should == "."
File.basename("..").should == ".."
platform_is_not :windows do
File.basename("//foo/").should == "foo"
File.basename("//foo//").should == "foo"
end
File.basename("foo/").should == "foo"
File.basename("foo.rb/", '.rb').should == "foo" # new line
it "ignores a trailing directory seperator" do
File.basename("foo.rb/", '.rb').should == "foo"
File.basename("bar.rb///", '.*').should == "bar"
end
Integer* Bignum::right_shift(STATE, Fixnum* bits) {
NMP;
int shift = bits->to_native();
diff --git a/vm/builtin/bignum.cpp b/vm/builtin/bignum.cpp
index 92b6d7f..1cd2205 100644
--- a/vm/builtin/bignum.cpp
+++ b/vm/builtin/bignum.cpp
@@ -663,7 +663,7 @@ namespace rubinius {
Integer* Bignum::right_shift(STATE, Fixnum* bits) {
NMP;
- int shift = bits->to_native();
+ native_int shift = bits->to_native();
diff --git a/vm/builtin/bignum.cpp b/vm/builtin/bignum.cpp
index 163f207..23cb377 100644
--- a/vm/builtin/bignum.cpp
+++ b/vm/builtin/bignum.cpp
@@ -96,24 +96,6 @@ namespace rubinius {
return res;
}
- static void twos_complement(mp_int *a)
- {
diff --git a/kernel/common/process.rb b/kernel/common/process.rb
index c97dade..c576f06 100644
--- a/kernel/common/process.rb
+++ b/kernel/common/process.rb
@@ -653,6 +653,7 @@ module Kernel
end
Process.waitpid(pid)
+ read.close
return output