Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
Callback( 'bai', :gsub )
Callback{ 'hai' }
'hai'.callback(:gsub)
static VALUE rb_callback_initialize( int argc, VALUE *argv, VALUE cb )
{
VALUE object;
VALUE method;
ID meth;
RCallback* cbs = GetCallbackStruct(cb);
if (rb_block_given_p()) {
if (argc == 1) rb_raise(rb_eArgError, "wrong number of arguments");
cbs->object = rb_block_proc();
static VALUE rb_f_callback( int argc, VALUE *argv )
{
return rb_callback_initialize( argc, argv, rb_callback_new() );
}
static VALUE
rb_obj_callback( VALUE obj, VALUE mid)
{
VALUE args[2];
args[0] = obj;
methodmissing:callback lourens$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.5.1]
methodmissing:callback lourens$ rake bench
(in /Users/lourens/projects/callback)
/opt/local/bin/ruby extconf.rb
creating Makefile
make
gcc -I. -I/opt/local/lib/ruby/1.8/i686-darwin9.5.1 -I/opt/local/lib/ruby/1.8/i686-darwin9.5.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -pipe -fno-common -c callback.c
cc -dynamic -bundle -undefined suppress -flat_namespace -o callback.bundle callback.o -L. -L/opt/local/lib -L. -ldl -lobjc
/opt/local/bin/ruby bench/bench.rb
checking for rb_thread_blocking_region()... no
checking for rb_trap_immediate in ruby.h,rubysig.h... yes
creating Makefile
make
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin9.5.1 -I. -DHAVE_RB_TRAP_IMMEDIATE -DRUBY18 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -pipe -fno-common -c hwia.c
cc -dynamic -bundle -undefined suppress -flat_namespace -o hwia.bundle hwia.o -L. -L/opt/local/lib -L. -ldl -lobjc
/opt/local/bin/ruby -I"ext/hwia" "/Users/lourens/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/test_hwia.rb"
Loaded suite /Users/lourens/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.................F..........
methodmissing:hwia lourens$ sudo gem install hwia-1.0.0.gem
Building native extensions. This could take a while...
Successfully installed hwia-1.0.0
1 gem installed
Installing ri documentation for hwia-1.0.0...
Installing RDoc documentation for hwia-1.0.0...
macbook-pros-computer:hwia lourens$ irb
>> require 'rubygems'
=> true
>> require 'hwia'
methodmissing:activesupport lourens$ git diff
diff --git a/activesupport/lib/active_support/core_ext/hash.rb b/activesupport/lib/active_support/core_ext/hash.rb
index 5014834..591363d 100644
--- a/activesupport/lib/active_support/core_ext/hash.rb
+++ b/activesupport/lib/active_support/core_ext/hash.rb
@@ -6,3 +6,5 @@ require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/reverse_merge'
require 'active_support/core_ext/hash/slice'
+
methodmissing:hwia lourens$ rake bench
(in /Users/lourens/projects/hwia)
/opt/local/bin/ruby bench/bench.rb
Rehearsal ------------------------------------------------------------------------------
StrHash#[:sym] 0.000000 0.000000 0.000000 ( 0.002949)
HashWithIndifferentAccess#[:sym] 0.020000 0.000000 0.020000 ( 0.021825)
StrHash#['str'] 0.010000 0.000000 0.010000 ( 0.012166)
HashWithIndifferentAccess#['str] 0.000000 0.000000 0.000000 ( 0.003780)
StrHash#key?(:sym) 0.010000 0.000000 0.010000 ( 0.002945)
HashWithIndifferentAccess#key?(:sym) 0.010000 0.000000 0.010000 ( 0.013988)
diff --git a/activesupport/lib/active_support/core_ext/hash.rb b/activesupport/lib/active_support/core_ext/hash.rb
index 5014834..591363d 100644
--- a/activesupport/lib/active_support/core_ext/hash.rb
+++ b/activesupport/lib/active_support/core_ext/hash.rb
@@ -6,3 +6,5 @@ require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/reverse_merge'
require 'active_support/core_ext/hash/slice'
+
+require 'hwia_rails'
static VALUE
flo_to_s(flt)
VALUE flt;
{
char buf[32];
double value = RFLOAT(flt)->value;
char *p, *e;
if (isinf(value))
return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");