This file contains 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'termios' | |
require 'github_api' | |
puts 'Github login:' | |
user = gets.chomp | |
oldt = Termios.tcgetattr($stdin) |
This file contains 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
r.on 'sidekiq' do | |
env[Rack::SCRIPT_NAME] = '/admin/sidekiq' | |
env[Rack::PATH_INFO] = r.remaining_path | |
status, headers, body = Sidekiq::Web.call(env) | |
response.status = status | |
response.headers.merge!(headers) | |
response.write body.join | |
end |
This file contains 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
Sou algo mais do que este punhado de terra | |
que, em sangue e nervos, se envaidece e se apega | |
e que ao pó, uma vez mais, há de retornar, disperso; | |
sou um abismo que o nada do universo quebra, | |
sou o espaço que seduz a matéria que me integra; | |
sou a luz de minha lâmpada na noite mais negra | |
e a mais negra noite quenaod minha lâmpada se apaga; | |
sou a fronteira dos outros, imprecisa e vaga. | |
Sou o esgar vencido dos velhos séculos | |
e o gesto prepotente dos séculas que ainda estão distantes: |
This file contains 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
#0 0x000000000060888a in rubinius::ObjectHeader::flags (this=0x0) at vm/oop.hpp:373 | |
#1 0x0000000000608948 in rubinius::ObjectHeader::type_id (this=0x0) at vm/oop.hpp:630 | |
#2 0x0000000000641c28 in rubinius::kind_of<rubinius::Array> (obj=0x0) at vm/gen/kind_of.hpp:16 | |
#3 0x0000000000646833 in rubinius::MachineCode::interpreter (state=0x18868f0, mcode=0x1ec60e0, call_frame=0x7ffffffc6c30) | |
at vm/gen/instruction_implementations.hpp:748 | |
#4 0x00000000007bc4ec in rubinius::BlockEnvironment::execute_interpreter (state=0x18868f0, previous=0x7ffffffc7d90, | |
env=0x7ffff665c3d0, args=..., invocation=...) at vm/builtin/block_environment.cpp:370 | |
#5 0x00000000007bbed5 in rubinius::BlockEnvironment::invoke (state=0x18868f0, previous=0x7ffffffc7d90, env=0x7ffff665c3d0, args=..., | |
invocation=...) at vm/builtin/block_environment.cpp:103 | |
#6 0x00000000007bc5c4 in rubinius::BlockEnvironment::call (this=0x7ffff665c3d0, state=0x18868f0, call_frame=0x7ffffffc7d90, args=..., |
This file contains 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
describe "taking |a, *b| arguments" do | |
it "raises an TypeError if #to_ary raises an error" do | |
obj = mock("block yield to_ary raising an error") | |
obj.should_receive(:to_ary).and_raise(StandardError) | |
lambda { @y.s(obj) { |a, *b| } }.should raise_error(TypeError) | |
end |
This file contains 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 asd.rb rubinius/git/master ! | |
require 'test/unit' | |
class TestFoo < Test::Unit::TestCase | |
def test_foo | |
obj1 = Object.new | |
obj2 = obj1.dup | |
def obj1.to_ary | |
raise | |
end |
This file contains 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
@@ -161,9 +165,18 @@ describe "A block" do | |
lambda { @y.s(obj) { |a, b| } }.should raise_error(TypeError) | |
end | |
+ | |
+ it "raises an exception if #to_ary raises an exception" do | |
+ obj = mock("block yield to_ary raising an exception") | |
+ obj.should_receive(:to_ary).and_raise(ZeroDivisionError) | |
+ | |
+ lambda { @y.s(obj) { |a, b| } }.should raise_error(ZeroDivisionError) |
This file contains 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/builtin/block_environment.cpp b/vm/builtin/block_environment.cpp | |
index d603156..ba93f94 100644 | |
--- a/vm/builtin/block_environment.cpp | |
+++ b/vm/builtin/block_environment.cpp | |
@@ -149,6 +149,13 @@ namespace rubinius { | |
if(!(ary = try_as<Array>(obj))) { | |
if(CBOOL(obj->respond_to(state, G(sym_to_ary), cFalse))) { | |
obj = obj->send(state, call_frame, G(sym_to_ary)); | |
+ if(!obj) { | |
+ Exception* exc = |
This file contains 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
x = 10 | |
def hi | |
frame = JRuby.runtime.current_context.frames(0)[1] | |
puts frame.send('binding').eval('x') | |
end | |
hi | |
# => 10 |
This file contains 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 Stamps | |
attr_reader :amount | |
def initialize(amount) | |
if (amount =~ /^\d+$/).nil? | |
raise ArgumentError, "The amount should be an integer" | |
end | |
if amount.to_i < 8 | |
raise ArgumentError, "The amount should be bigger than 7" |