Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/svenfuchs/pathname_local
https://github.com/svenfuchs/pathname_local
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/svenfuchs/pathname_local
- Owner: svenfuchs
- Created: 2010-07-17T15:17:14.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2010-07-17T15:27:35.000Z (over 14 years ago)
- Last Synced: 2024-04-24T01:20:50.542Z (8 months ago)
- Language: Ruby
- Size: 93.8 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
Awesome Lists containing this project
README
h1. Pathname.local(path)
Super-tiny gem that adds Pathname.local(path):
Pathname.module_eval do
def self.local(path)
new(File.expand_path(File.join('..', path), caller.last))
end
endSo, e.g. in a test_helper.rb file one could do:
fixtures_path = Pathname.local('fixtures')
Instead of the much more verbose:fixtures_path = Pathname.new(File.expand_path('../fixtures', __FILE__))