Skip to content

Instantly share code, notes, and snippets.

@drodriguez
Created March 26, 2013 20:42
Show Gist options
  • Save drodriguez/5249052 to your computer and use it in GitHub Desktop.
Save drodriguez/5249052 to your computer and use it in GitHub Desktop.
How to get some path components using only Ruby stdlib.
require 'pathname'
Pathname.new(`pwd`.strip).enum_for(:descend).map { |x| x.basename.to_path }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment