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
irb(main):001:0> def me(foo) | |
irb(main):002:1> if foo | |
irb(main):003:2> $1 | |
irb(main):004:2> else | |
irb(main):005:2* nil | |
irb(main):006:2> end | |
irb(main):007:1> end | |
=> #<Rubinius::CompiledMethod me file=(irb)> | |
irb(main):008:0> exit | |
An exception occurred running IRB |
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
require 'rubygems' | |
require 'nokogiri' | |
html = %q{blah http://google.com blah blah} | |
new_html = %q{blah <a href="http://google.com">http://google.com</a> blah blah} | |
frag = Nokogiri::HTML.fragment(html) | |
text = frag.children.first | |
p frag.to_html |
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 DebArchive < Archive | |
def content_subdir | |
"." | |
end | |
def extract_command | |
"" | |
end | |
end | |
Archive.CLASSES.merge! :deb => DebArchive |
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 SomeModel < ActiveRecord::Base | |
def some_method | |
raise NotImplementedError | |
end | |
end | |
module Api::V1::SomeModelMethods | |
def some_method | |
return {:blah => 1} | |
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
Building openssl | |
=== OpenSSL for Ruby configurator === | |
=== Checking for system dependent stuff... === | |
checking for t_open() in -lnsl... no | |
checking for socket() in -lsocket... no | |
checking for assert.h... yes | |
checking for sys/time.h... yes | |
checking for unistd.h... yes | |
checking for assert.h... yes | |
=== Checking for required stuff... === |
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
openssl [master*] $ ../../../bin/rbx -Xint extconf.rb | |
=== OpenSSL for Ruby configurator === | |
=== Checking for system dependent stuff... === | |
checking for t_open() in -lnsl... no | |
checking for socket() in -lsocket... no | |
checking for assert.h... yes | |
checking for sys/time.h... yes | |
checking for unistd.h... yes | |
checking for assert.h... yes | |
=== Checking for required stuff... === |
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 "Symbol#[]" do | |
describe "with a Fixnum index" do | |
it "returns the character code of the element at the index" | |
describe "an index that is out of bounds" do | |
it "returns nil if the index is before the start" | |
it "return nil if the index is past the end" | |
end | |
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
RSpec::Matchers.define :have_before_filter do |filter| | |
match do |actual| | |
actual._process_action_callbacks.select { |c| c.kind == :before }.map(&:filter).include?(filter) | |
end | |
end | |
MyController.should have_before_filter(:filter_name) |
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
module InterruptibleSleep | |
def interruptible_sleep(seconds) | |
@_sleep_check, @_sleep_interrupt = IO.pipe | |
IO.select([@_sleep_check], nil, nil, seconds) | |
end | |
def interrupt_sleep | |
@_sleep_interrupt.close if @_sleep_interrupt | |
end | |
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
diff --git a/kernel/common/module.rb b/kernel/common/module.rb | |
index dffe98a..5bb7501 100644 | |
--- a/kernel/common/module.rb | |
+++ b/kernel/common/module.rb | |
@@ -168,25 +168,41 @@ class Module | |
end | |
def public_method_defined?(sym) | |
- sym = Rubinius::Type.coerce_to_symbol(sym) | |
+ sym = sym.to_str if sym.respond_to?(:to_str) |
OlderNewer