Class: Codeforces::Models::Problems

Inherits:
Base
  • Object
show all
Defined in:
lib/codeforces/models/problems.rb

Instance Attribute Summary

Attributes inherited from Base

#base, #client

Instance Method Summary collapse

Methods inherited from Base

#grep, #invert_grep

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