Skip to content

Instantly share code, notes, and snippets.

@moro
Created March 17, 2009 03:29
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 moro/80263 to your computer and use it in GitHub Desktop.
Save moro/80263 to your computer and use it in GitHub Desktop.
require 'pathname'
path = "/Users/home/moro/work/xxx/spec/fixtures/me.png"
re = /^.*#{File::SEPARATOR}([^#{File::SEPARATOR}]+)$/
p Pathname.new(path).sub(re){ $1 }
p Pathname.new( Pathname.new(path).instance_variable_get("@path").dup.sub(re){ $1 } )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment