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.



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

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

Class Method Details

.limiter_parametersObject



17
18
19
# File 'lib/gitlab/triage/limiters/base_limiter.rb', line 17

def self.limiter_parameters
  []
end

Instance Method Details

#initialize_resources(resources) ⇒ Object (private)



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

def initialize_resources(resources)
  resources
end

#initialize_variables(limit) ⇒ Object (private)



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

def initialize_variables(limit); end

#limitObject

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/gitlab/triage/limiters/base_limiter.rb', line 13

def limit
  raise NotImplementedError
end

#validate_limit(limit) ⇒ Object (private)



29
30
31
# File 'lib/gitlab/triage/limiters/base_limiter.rb', line 29

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