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
| class Module | |
| def append_features(base) | |
| base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block") | |
| end | |
| def included(klass = nil, &block) | |
| if block_given? | |
| @_included_block = block | |
| else | |
| super if defined?(super) |
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
| class Foo | |
| A = "Foo::A" | |
| @@b = "Foo::@@b" | |
| end | |
| module MyClassEval | |
| A = "MyClassEval::A" | |
| @@b = "MyClassEval::@@b" | |
| def self.my_class_eval(klass, &block) | |
| klass.class_eval(&block) |
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/iseq.c b/iseq.c | |
| index 80364ca..fc13d70 100644 | |
| --- a/iseq.c | |
| +++ b/iseq.c | |
| @@ -1344,11 +1344,15 @@ rb_iseq_clone(VALUE iseqval, VALUE newcbase) | |
| if (!iseq1->orig) { | |
| iseq1->orig = iseqval; | |
| } | |
| + if (iseq0->local_iseq == iseq0) { | |
| + iseq1->local_iseq = iseq1; |
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/vm.c b/vm.c | |
| index b4d0f39..949fdb6 100644 | |
| --- a/vm.c | |
| +++ b/vm.c | |
| @@ -69,7 +69,7 @@ static inline VALUE | |
| rb_vm_set_finish_env(rb_thread_t * th) | |
| { | |
| vm_push_frame(th, 0, VM_FRAME_MAGIC_FINISH, | |
| - Qnil, rb_cObject, th->cfp->lfp[0], 0, | |
| + Qnil, Qnil, th->cfp->lfp[0], 0, |
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
| Building native extensions. This could take a while... | |
| ERROR: Error installing mysql2: | |
| ERROR: Failed to build gem native extension. | |
| /home/shugo/local/bin/ruby-trunk extconf.rb | |
| checking for rb_thread_blocking_region()... no | |
| checking for mysql.h... yes | |
| checking for errmsg.h... yes | |
| checking for mysqld_error.h... yes | |
| creating Makefile |
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
| SHELL = /bin/sh | |
| # V=0 quiet, V=1 verbose. other values don't work. | |
| V = 0 | |
| Q1 = $(V:1=) | |
| Q = $(Q1:0=@) | |
| n=$(NULLCMD) | |
| ECHO1 = $(V:1=@$n) | |
| ECHO = $(ECHO1:0=@echo) |
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
| have_func: checking for rb_thread_blocking_region()... -------------------- no | |
| "gcc -o conftest -I/home/shugo/local/include/ruby-1.9.1/i686-linux -I/home/shugo/local/include/ruby-1.9.1/ruby/backward -I/home/shugo/local/include/ruby-1.9.1 -I. -D_FILE_OFFSET_BITS=64 -O0 -g -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -L/home/shugo/local/lib -Wl,-R/home/shugo/local/lib -L. -rdynamic -Wl,-export-dynamic -lpthread -lrt -ldl -lcrypt -lm -lc" | |
| checked program was: | |
| /* begin */ | |
| 1: #include "ruby.h" | |
| 2: | |
| 3: int main() {return 0;} | |
| /* end */ |
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
| require "pp" | |
| def queens(n, k = n) | |
| if k == 0 | |
| [[]] | |
| else | |
| queens(n, k - 1).flat_map {|queens| | |
| (1..n).map {|col| [k, col]}.select {|queen| | |
| queens.all? {|q| | |
| q[0] != queen[0] && |
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
| require 'net/https' | |
| http = Net::HTTP.new("example.com", 443) | |
| http.use_ssl = true | |
| http.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
| store = OpenSSL::X509::Store.new | |
| store.set_default_paths | |
| http.cert_store = store | |
| # For Windows, use Net::HTTP#ca_file= instead of the above three lines as follows: | |
| # http.ca_file = "/path/to/cacert.pem" | |
| # Root certificates are available at http://curl.haxx.se/ca/cacert.pem |
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
| $ cat t.rb | |
| b = eval("def get_binding; binding; end; get_binding", | |
| TOPLEVEL_BINDING, | |
| __FILE__, | |
| __LINE__ - 3) | |
| p eval(<<EOF, b) | |
| def foo; end | |
| self.foo | |
| EOF | |
| $ ~/ruby/1.9.2/bin/ruby-1.9.2 -v /tmp/t.rb |
OlderNewer