class KUtil::FileHelper
Helper methods attached to the namespace for working with Files
Public Instance Methods
expand_path(filename, base_path = nil)
click to toggle source
# File lib/k_util/file_helper.rb, line 7 def expand_path(filename, base_path = nil) if pathname_absolute?(filename) filename elsif filename.start_with?('~/') File.expand_path(filename) else File.expand_path(filename, base_path) end end
home?(path)
click to toggle source
# File lib/k_util/file_helper.rb, line 17 def home?(path) path.start_with?('~/') end
home_or_absolute?(path)
click to toggle source
# File lib/k_util/file_helper.rb, line 26 def home_or_absolute?(path) home?(path) || absolute?(path) end
pathname_absolute?(pathname)
click to toggle source
# File lib/k_util/file_helper.rb, line 21 def pathname_absolute?(pathname) Pathname.new(pathname).absolute? end
Also aliased as: absolute?