class WinAlias::Alias

Public Class Methods

delete!(name) click to toggle source
# File lib/win_alias/alias.rb, line 10
def self.delete!(name)
  path = File.join(WinAlias.path, "#{name}.bat")
  return true unless File.exist?(path)
  FileUtils.rm(path)
  !File.exist?(path)
end
list() click to toggle source
# File lib/win_alias/alias.rb, line 17
def self.list
  BBLib.scan_dir(WinAlias.path, '*.bat').map { |f| f.file_name(false) }.sort
end

Public Instance Methods

build_command() click to toggle source
# File lib/win_alias/alias.rb, line 25
def build_command
  (echo_off? ? "@ECHO OFF\n" : '') + command
end
path() click to toggle source
# File lib/win_alias/alias.rb, line 21
def path
  File.join(WinAlias.path, "#{name}.bat")
end
save() click to toggle source
# File lib/win_alias/alias.rb, line 29
def save
  build_command.to_file(path, mode: 'w')
end