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 Husband | |
attr_accessor :affair | |
def say | |
puts "I love my wife." | |
end | |
end | |
module Secret | |
refine Husband do | |
def say |
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
# Running tests: | |
[21/27] TestRequire#test_require_to_path_redefined_in_load_path = 0.07 s | |
1) Failure: | |
test_require_to_path_redefined_in_load_path(TestRequire) [/Users/nagachika/opt/ruby-trunk/src/ruby/test/ruby/test_require.rb:504]: | |
[ruby-core:47970]. | |
<[":ok"]> expected but was | |
<["[:ng, [\"/Users/nagachika/opt/ruby-trunk/src/build\", \"/Users/nagachika/opt/ruby-trunk/src/build/.ext/common\", \"/Users/nagachika/opt/ruby-trunk/src/build/.ext/x86_64-darwin12.2.0\", \"/Users/nagachika/opt/ruby-trunk/src/ruby/lib\", \"/Users/nagachika/opt/ruby-trunk/lib/ruby/site_ruby/2.0.0\", \"/Users/nagachika/opt/ruby-trunk/lib/ruby/site_ruby/2.0.0/x86_64-darwin12.2.0\", \"/Users/nagachika/opt/ruby-trunk/lib/ruby/site_ruby\", \"/Users/nagachika/opt/ruby-trunk/lib/ruby/vendor_ruby/2.0.0\", \"/Users/nagachika/opt/ruby-trunk/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin12.2.0\", \"/Users/nagachika/opt/ruby-trunk/lib/ruby/vendor_ruby\", \"/Users/nagachika/opt/ruby-trunk/lib/ruby/2.0.0\", \"/Users/nagachika/opt/ruby-trunk/lib/ruby/2.0 |
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
load 'deploy' if respond_to?(:namespace) | |
load 'config/deploy' | |
require "capistrano_colors" | |
set :stages, %w(sample_stage) | |
set :default_stage, "sample_stage" | |
require 'capistrano/ext/multistage' |
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 'bundler/setup' | |
require 'active_record' | |
require 'logger' | |
namespace :db do | |
desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x" | |
task :migrate => :environment do | |
ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil ) | |
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
require 'active_support/dependencies' | |
ActiveSupport::Dependencies.autoload_paths << File.expand_path('../lib', __FILE__) |
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
ary = (0..10).to_a | |
o = Object.new | |
o.instance_variable_set(:@ary, ary) | |
def o.to_ary | |
@ary | |
end | |
l = [o].lazy.flat_map{|x| x} | |
p l.next # => 0 | |
ary.clear |
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
enum Cap { Black, White } | |
abstract sig Children { | |
cap: one Cap, | |
visible: set Children | |
} | |
one sig A extends Children {} { | |
visible = none | |
cap = Black |
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
# `publish' all private instance methods | |
ObjectSpace.each_object(Module) do |mod| | |
mod.private_instance_methods(false).each do |meth| | |
mod.__send__(:public, meth) | |
end | |
end | |
# define accessor methods as ghost method | |
class Object | |
def method_missing(meth, *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
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb | |
index 76eb82c..0fbec35 100644 | |
--- a/test/ruby/test_io.rb | |
+++ b/test/ruby/test_io.rb | |
@@ -1409,13 +1409,15 @@ class TestIO < Test::Unit::TestCase | |
end | |
def try_fdopen(fd, autoclose = true, level = 100) | |
- if level > 0 | |
- try_fdopen(fd, autoclose, level - 1) |
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/lib/test/unit.rb b/lib/test/unit.rb | |
index eb0666a..00313a3 100644 | |
--- a/lib/test/unit.rb | |
+++ b/lib/test/unit.rb | |
@@ -457,7 +457,9 @@ module Test | |
bang = $1 | |
worker.status = :ready | |
if @tasks.empty? | |
- break unless @workers.find{|x| x.status == :running } | |
+ unless @workers.find{|x| [:running, :prepare].include? x.status} |