Skip to content

Instantly share code, notes, and snippets.

@ayucat
Created July 16, 2009 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayucat/148413 to your computer and use it in GitHub Desktop.
Save ayucat/148413 to your computer and use it in GitHub Desktop.
# ayucat 2009-07-16
# add to rakefile.rb as follows:
# RSTRING/RARRAY for Ruby 1.9.x
edit_file "xxx.c_or_h" do |line|
case line
when /RSTRING\(([^\)]+)\)->(ptr|len)/
line.sub(/RSTRING\(([^\)]+)\)->ptr/, 'RSTRING_PTR(\1)').sub(/RSTRING\(([^\)]+)\)->len/, 'RSTRING_LEN(\1)')
when /RARRAY\(([^\)]+)\)->ptr/
line.sub(/RARRAY\(([^\)]+)\)->ptr/, 'RARRAY_PTR(\1)')
else
nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment