Last active
March 22, 2017 04:38
-
-
Save awesome/c642dd70a0dab163321bda5a1596325d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# irb(main):011:0> File.expand_path(File.dirname(__FILE__)) | |
# => "/Users/dev/Documents/Bordee/repo/svelte-ruby" | |
# irb(main):012:0> File.dirname(File.expand_path(__FILE__)) | |
# => "/Users/dev/Documents/Bordee/repo/svelte-ruby" | |
# irb(main):012:0> File.expand_path('..', __FILE__) | |
# => "/Users/dev/Documents/Bordee/repo/svelte-ruby" | |
# right? so let's do this lol | |
module FileExt | |
def self.expand_dir(string) | |
case rand(3) | |
when 0 | |
::File.expand_path(File.dirname(string)) | |
when 1 | |
::File.dirname(File.expand_path(string)) | |
else # 3 | |
::File.expand_path('..', string) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment