Class: Codeforces::Models::Base

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

Direct Known Subclasses

Contest, Contests, Problem, Problems, Submission, User, Users

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(new_client, new_base) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'lib/codeforces/models/base.rb', line 8

def initialize(new_client, new_base)
  @client = new_client
  @base = new_base
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (protected)



49
50
51
# File 'lib/codeforces/models/base.rb', line 49

def method_missing(method, *args, &block)
  base.send method, *args, &block
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



6
7
8
# File 'lib/codeforces/models/base.rb', line 6

def base
  @base
end

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/codeforces/models/base.rb', line 5

def client
  @client
end

Instance Method Details

#grep(option) ⇒ Object



17
18
19
# File 'lib/codeforces/models/base.rb', line 17

def grep(option)
  chain(base.select {|x| match?(option, x) })
end

#invert_grep(option) ⇒ Object



13
14
15
# File 'lib/codeforces/models/base.rb', line 13

def invert_grep(option)
  chain(base.select {|x| not_match?(option, x) })
end