Class: Acclir::AtCoder::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/acclir/at_coder/task.rb

Overview

AtCoder problem

Constant Summary collapse

SAMPLE_INPUT_TITLE =
"Sample Input"
SAMPLE_OUTPUT_TITLE =
"Sample Output"
PATH_REGEX_PROC =
->(contest_id) { %r{^/contests/#{contest_id}/tasks/(?<task>\w+)$} }
PATH_PROC =
->(contest_id, id) { "/contests/#{contest_id}/tasks/#{id}" }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contest_id, id) ⇒ Task

Returns a new instance of Task.



15
16
17
18
# File 'lib/acclir/at_coder/task.rb', line 15

def initialize(contest_id, id)
  @contest_id = contest_id
  @id = id
end

Instance Attribute Details

#contest_idObject (readonly)

Returns the value of attribute contest_id.



13
14
15
# File 'lib/acclir/at_coder/task.rb', line 13

def contest_id
  @contest_id
end

#idObject (readonly)

Returns the value of attribute id.



13
14
15
# File 'lib/acclir/at_coder/task.rb', line 13

def id
  @id
end

Instance Method Details

#samplesObject



20
21
22
# File 'lib/acclir/at_coder/task.rb', line 20

def samples
  @samples ||= extract_samples.map { |input, output| Sample.new(input, output) }
end