Module: Helpers

Defined in:
lib/sheldon/helpers.rb

Instance Method Summary collapse

Instance Method Details

#abs(rel_path) ⇒ Object



14
15
16
# File 'lib/sheldon/helpers.rb', line 14

def abs(rel_path)
  File.expand_path(rel_path).to_s
end

#add_home(path) ⇒ Object



9
10
11
12
# File 'lib/sheldon/helpers.rb', line 9

def add_home(path)
  abs_home = File.expand_path("~")
  File.join(abs_home, path).to_s
end

#remove_home(path) ⇒ Object



4
5
6
7
# File 'lib/sheldon/helpers.rb', line 4

def remove_home(path)
  home_path = Pathname(File.expand_path("~"))
  Pathname(path).relative_path_from(home_path).to_s
end