Class: Clicoder::Starter

Inherits:
Thor
  • Object
show all
Defined in:
lib/clicoder/cli.rb

Instance Method Summary collapse

Instance Method Details

#aoj(problem_number) ⇒ Object



20
21
22
23
# File 'lib/clicoder/cli.rb', line 20

def aoj(problem_number)
  aoj = AOJ.new(problem_number)
  start_with(aoj)
end

#atcoder(task_url) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/clicoder/cli.rb', line 26

def atcoder(task_url)
  match_regexp = %r{http://([^.]*)\.contest\.atcoder\.jp/tasks/(.*)}
  if m = task_url.match(match_regexp)
    contest_id, task_id = task_url.match(match_regexp)[1, 2]
  else
    raise ArgumentError, 'Please provide a valid atcoder task url.'
  end

  atcoder = AtCoder.new(contest_id, task_id)
  start_with(atcoder)
end

#sample_siteObject



14
15
16
17
# File 'lib/clicoder/cli.rb', line 14

def sample_site
  sample_site = SampleSite.new
  start_with(sample_site)
end