This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Callback( 'bai', :gsub ) | |
| Callback{ 'hai' } | |
| 'hai'.callback(:gsub) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.......... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' | |
| + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"); |