Module: Codeforces::Helper
- Included in:
- Client
- Defined in:
- lib/codeforces/helper.rb
Instance Method Summary collapse
- #contest(query) ⇒ Object
- #contests ⇒ Object
- #each_contest ⇒ Object
- #each_status ⇒ Object
- #problems ⇒ Object
- #recent_status ⇒ Object
- #rounds(*args) ⇒ Object
- #user(handle) ⇒ Object
- #users ⇒ Object
Instance Method Details
#contest(query) ⇒ Object
7 8 9 |
# File 'lib/codeforces/helper.rb', line 7 def contest(query) create_contest resolve_contest(query) end |
#contests ⇒ Object
15 16 17 |
# File 'lib/codeforces/helper.rb', line 15 def contests create_contests api.contest.list.map {|c| create_contest c } end |
#each_contest ⇒ Object
19 20 21 |
# File 'lib/codeforces/helper.rb', line 19 def each_contest contests.each {|contest| yield(contest) if block_given? } end |
#each_status ⇒ Object
35 36 37 |
# File 'lib/codeforces/helper.rb', line 35 def each_status recent_status.each {|status| yield(status) if block_given? } end |
#problems ⇒ Object
3 4 5 |
# File 'lib/codeforces/helper.rb', line 3 def problems @problems ||= create_problems(api.problemset.problems.map {|p| create_problem p }) end |
#recent_status ⇒ Object
31 32 33 |
# File 'lib/codeforces/helper.rb', line 31 def recent_status api.problemset.recent_status.map {|s| create_submission s } end |
#rounds(*args) ⇒ Object
11 12 13 |
# File 'lib/codeforces/helper.rb', line 11 def rounds(*args) contests.send :rounds, *args end |
#user(handle) ⇒ Object
23 24 25 |
# File 'lib/codeforces/helper.rb', line 23 def user(handle) create_user api.user.info(handle).first end |
#users ⇒ Object
27 28 29 |
# File 'lib/codeforces/helper.rb', line 27 def users create_users api.user.rated_list.map {|u| create_user u } end |