Class: Exekutor::Asynchronous::ArgumentValidator::ArgumentCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/exekutor/asynchronous.rb

Overview

Keeps track of the minimum and maximum number of allowed arguments

Instance Method Summary collapse

Constructor Details

#initializeArgumentCounter

Returns a new instance of ArgumentCounter.



232
233
234
# File 'lib/exekutor/asynchronous.rb', line 232

def initialize
  @min = @max = 0
end

Instance Method Details

#clear_maxObject



241
242
243
# File 'lib/exekutor/asynchronous.rb', line 241

def clear_max
  @max = nil
end

#increment(type) ⇒ Object



236
237
238
239
# File 'lib/exekutor/asynchronous.rb', line 236

def increment(type)
  @min += 1 if type == :req
  @max += 1 if @max
end

#to_rangeObject



245
246
247
# File 'lib/exekutor/asynchronous.rb', line 245

def to_range
  @min..@max
end