Module: AtCoderFriends::PathUtil
- Included in:
- CLI, Emitter, JudgeTestRunner, SampleTestRunner, ScrapingAgent, TestRunner
- Defined in:
- lib/at_coder_friends/path_util.rb
Overview
Common methods and behaviors for dealing with paths.
Constant Summary collapse
- SMP_DIR =
'data'- CASES_DIR =
'cases'
Class Method Summary collapse
- .cases_dir(dir) ⇒ Object
- .contest_name(path) ⇒ Object
- .smp_dir(dir) ⇒ Object
- .split_prg_path(path) ⇒ Object
Class Method Details
.cases_dir(dir) ⇒ Object
29 30 31 |
# File 'lib/at_coder_friends/path_util.rb', line 29 def cases_dir(dir) File.join(dir, CASES_DIR) end |
.contest_name(path) ⇒ Object
11 12 13 14 15 |
# File 'lib/at_coder_friends/path_util.rb', line 11 def contest_name(path) path = File.(path) dir = File.file?(path) ? File.dirname(path) : path File.basename(dir).delete('#').downcase end |
.smp_dir(dir) ⇒ Object
25 26 27 |
# File 'lib/at_coder_friends/path_util.rb', line 25 def smp_dir(dir) File.join(dir, SMP_DIR) end |
.split_prg_path(path) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/at_coder_friends/path_util.rb', line 17 def split_prg_path(path) path = File.(path) dir, prg = File.split(path) base, ext = prg.split('.') q = base.split('_')[0] [path, dir, prg, base, ext, q] end |