Module: Helpers

Defined in:
lib/sheldon/helpers.rb

Instance Method Summary collapse

Instance Method Details

#abs(rel_path) ⇒ Object



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

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

#add_home(path) ⇒ Object



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

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

#remove_home(path) ⇒ Object



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

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