Class: Gitlab::Triage::Limiters::BaseLimiter

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/triage/limiters/base_limiter.rb

Direct Known Subclasses

DateFieldLimiter

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resources, limit) ⇒ BaseLimiter

Returns a new instance of BaseLimiter.



9
10
11
12
13
# File 'lib/gitlab/triage/limiters/base_limiter.rb', line 9

def initialize(resources, limit)
  @resources = initialize_resources(resources)
  validate_limit(limit)
  initialize_variables(limit)
end

Class Method Details

.limiter_parametersObject



19
20
21
# File 'lib/gitlab/triage/limiters/base_limiter.rb', line 19

def self.limiter_parameters
  []
end

Instance Method Details

#initialize_resources(resources) ⇒ Object (private)



27
28
29
# File 'lib/gitlab/triage/limiters/base_limiter.rb', line 27

def initialize_resources(resources)
  resources
end

#initialize_variables(limit) ⇒ Object (private)



25
# File 'lib/gitlab/triage/limiters/base_limiter.rb', line 25

def initialize_variables(limit); end

#limitObject

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/gitlab/triage/limiters/base_limiter.rb', line 15

def limit
  raise NotImplementedError
end

#validate_limit(limit) ⇒ Object (private)



31
32
33
# File 'lib/gitlab/triage/limiters/base_limiter.rb', line 31

def validate_limit(limit)
  LimiterValidator.new(self.class.limiter_parameters, limit).validate!
end