Class: Codeforces::Models::Problems
- Defined in:
- lib/codeforces/models/problems.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #contest(id) ⇒ Object
-
#initialize(new_client, new_base) ⇒ Problems
constructor
A new instance of Problems.
Methods inherited from Base
Constructor Details
#initialize(new_client, new_base) ⇒ Problems
Returns a new instance of Problems.
5 6 7 8 9 10 11 12 |
# File 'lib/codeforces/models/problems.rb', line 5 def initialize(new_client, new_base) super new_client, new_base @contest = {} new_base.each do |problem| @contest[problem.contestId] ||= [] @contest[problem.contestId].push problem end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Codeforces::Models::Base
Instance Method Details
#contest(id) ⇒ Object
14 15 16 17 |
# File 'lib/codeforces/models/problems.rb', line 14 def contest(id) @contest[id] ||= [] self.class.new client, @contest[id] end |