Module: Fancypath::Helpers

Included in:
Pathname, String
Defined in:
lib/fancypath/fancypath.rb

Instance Method Summary collapse

Instance Method Details

#to_expanded_fancypathObject Also known as: p


11
12
13
# File 'lib/fancypath/fancypath.rb', line 11

def to_expanded_fancypath
  Fancypath.new File.expand_path(to_tilde_expanded_path)
end

#to_fancypathObject


7
8
9
# File 'lib/fancypath/fancypath.rb', line 7

def to_fancypath
  Fancypath.new to_tilde_expanded_path
end

#to_tilde_expanded_pathObject


16
17
18
# File 'lib/fancypath/fancypath.rb', line 16

def to_tilde_expanded_path
  sub(/^\~\/|^\~$/) {|_| Etc.getpwuid(Process.euid).dir.end_with('/') }
end