Skip to content

Instantly share code, notes, and snippets.

@swdyh
Created August 14, 2011 12:03
Show Gist options
  • Save swdyh/1144830 to your computer and use it in GitHub Desktop.
Save swdyh/1144830 to your computer and use it in GitHub Desktop.
diff -ur ../../../ruby-1.8.7-p302/gems/refe-0.8.0.3/lib/refe/fsdbm.rb ./lib/refe/fsdbm.rb
--- ../../../ruby-1.8.7-p302/gems/refe-0.8.0.3/lib/refe/fsdbm.rb 2011-08-14 20:56:32.000000000 +0900
+++ ./lib/refe/fsdbm.rb 2011-08-14 19:59:40.000000000 +0900
@@ -85,7 +85,7 @@
def encode( str )
str.gsub(/[^a-z0-9_]/n) {|ch|
- (/[A-Z]/n === ch) ? "-#{ch}" : sprintf('%%%02x', ch[0])
+ (/[A-Z]/n === ch) ? "-#{ch}" : sprintf('%%%02x', ch[0].bytes.first)
}.downcase
end
diff -ur ../../../ruby-1.8.7-p302/gems/refe-0.8.0.3/lib/refe/mygetopt.rb ./lib/refe/mygetopt.rb
--- ../../../ruby-1.8.7-p302/gems/refe-0.8.0.3/lib/refe/mygetopt.rb 2011-08-14 20:56:32.000000000 +0900
+++ ./lib/refe/mygetopt.rb 2011-08-14 20:57:43.000000000 +0900
@@ -11,7 +11,7 @@
alias orignew new
def new( usage, descripter )
- parser = orignew( * descripter.map {|line|
+ parser = orignew( * descripter.lines.map {|line|
line.strip!
next if line.empty?
display, shortopt, longopt, takearg, doc = line.split(/\s+/, 5)
@@ -35,7 +35,7 @@
f = (status == 0 ? $stdout : $stderr)
f.puts "#{File.basename $0}: #{errmsg}" if errmsg
- @usage.each do |uline|
+ @usage.lines.each do |uline|
if /%%options%%/ === uline
print_options f
else
@@ -46,7 +46,7 @@
end
def print_options( f )
- @descripter.each do |line|
+ @descripter.lines.each do |line|
line.strip!
if line.empty?
f.puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment