Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.