class Batali::Utility

Utility class to provide helper methods

Constants

UNC_PREFIX

Prefix for building UNC paths on Windows

Public Class Methods

clean_path(path) click to toggle source

Properly format and expand path based on platform in use

# File lib/batali/utility.rb, line 12
def self.clean_path(path)
  path = File.expand_path(path.to_s)
  if RUBY_PLATFORM =~ /mswin|mingw|windows/ &&
     path.downcase.match(/^[a-z]:/) &&
     ENV["BATALI_DISABLE_UNC"].nil?
    path = UNC_PREFIX + path
  end
  path
end
join_path(base, *args) click to toggle source

Join arguments to base path and clean

@param base [String] base path @param args [Array<String>] @return [String]

# File lib/batali/utility.rb, line 27
def self.join_path(base, *args)
  clean_path(File.join(base, *args))
end