class AtCoderFriends::PathInfo

holds target path information

Constants

CASES_DIR
SMP_DIR
TMP_DIR

Attributes

dir[R]
path[R]

Public Class Methods

new(path) click to toggle source
# File lib/at_coder_friends/path_info.rb, line 12
def initialize(path)
  @path = path
  # in setup command, path is directory name (existent/non-existent)
  # in other commands(test, submit, verify), path is existent file name
  @dir = File.file?(path) ? File.dirname(path) : path
end

Public Instance Methods

cases_dir() click to toggle source
# File lib/at_coder_friends/path_info.rb, line 39
def cases_dir
  File.join(dir, CASES_DIR)
end
cases_out_dir() click to toggle source
# File lib/at_coder_friends/path_info.rb, line 43
def cases_out_dir
  File.join(dir, TMP_DIR, CASES_DIR)
end
components() click to toggle source
# File lib/at_coder_friends/path_info.rb, line 23
def components
  # overwrites @dir here for non-existent files (test purpose)
  @dir, prg = File.split(path)
  base, ext = prg.split('.')
  q = base.gsub(/_[^#_]+\z/, '')
  [path, dir, prg, base, ext, q]
end
contest_name() click to toggle source
# File lib/at_coder_friends/path_info.rb, line 19
def contest_name
  File.basename(dir).delete('#').downcase
end
smp_dir() click to toggle source
# File lib/at_coder_friends/path_info.rb, line 35
def smp_dir
  File.join(dir, SMP_DIR)
end
src_dir() click to toggle source
# File lib/at_coder_friends/path_info.rb, line 31
def src_dir
  dir
end
tmp_dir() click to toggle source
# File lib/at_coder_friends/path_info.rb, line 47
def tmp_dir
  File.join(dir, TMP_DIR)
end