Skip to content

Instantly share code, notes, and snippets.

TestRubyOptions#test_kanji = 0.05 s
1) Failure:
TestRubyOptions#test_kanji [/Users/nagachika/opt/ruby-trunk/src/ruby/test/ruby/test_rubyoptions.rb:131]:
<["EUC-JP"]> expected but was
<[]>.
---
<[]> expected but was
<["/Users/nagachika/opt/ruby-trunk/src/ruby/lib/rubygems/specification.rb:710:in `[]': invalid byte sequence in EUC-JP (ArgumentError)",
"\tfrom /Users/nagachika/opt/ruby-trunk/src/ruby/lib/rubygems/specification.rb:710:in `block in each_gemspec'",
"\tfrom /Users/nagachika/opt/ruby-trunk/src/ruby/lib/rubygems/specification.rb:709:in `each'",
p "in bar.rb"
@nagachika
nagachika / Gemfile
Last active August 29, 2015 14:02
ActiveSupport::Dependencies and const_get(const, false)
source "https://rubygems.org"
#gem "activesupport", "~> 3.2.18"
gem "activesupport", "~> 4.1.1"
@nagachika
nagachika / a.rb
Created July 7, 2014 14:50
ruby constant lookup
module A
class << self
def foo
p B
end
end
B = "A::B"
end
% make prereq
making srcs under enc
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h unchanged
generating ../ruby/ext/ripper/ripper.c
extracting ripper.y from ../../parse.y
id.h not found in ["../.."]
make[1]: *** [ripper.y] Error 1
make: *** [../ruby/ext/ripper/ripper.c] Error 2
class A
Const = lambda{ p [ :in_lambda, self, @foo ] }
define_method(:meth) do
p [:in_method, self, @foo]
Const.call
end
def initialize
@foo = 72
@nagachika
nagachika / reproduce.rb
Created January 22, 2015 04:54
weird behavior of psych with activesupport on 2.2.0/2.1.5
gem 'activesupport'
require "psych"
p Psych.respond_to?(:load_file) # => should print "true" but print "false" when psych-2.0.11.gem was installed
1. ruby extconf.rb
2. make
3. ruby test11328.rb
4. watch memory usage of 3. process
You should reproduce Makefile (step 1) if you try another version of ruby.
outdated = `port outdated`.split("¥n")
if /No installed ports are outdated./ =~ outdated[0]
puts outdated[0]
exit 0
end
unless /The following installed ports are outdated:/ =~ outdated[0]
$stderr.puts "port outdated failed, maybe..."
$stderr.puts *outdated
exit 1
@nagachika
nagachika / eucjp_filter.rb
Created July 24, 2009 05:38
termtter plug-in for euc-jp terminal
# -*- coding: utf-8 -*-
# Termtter plugins for EUC-JP terminal.
#
require "kconv"
module ::Readline
class << self
alias :readline_old :readline
end