Class: Exekutor::Asynchronous::ArgumentValidator::ArgumentCounter
- Inherits:
-
Object
- Object
- Exekutor::Asynchronous::ArgumentValidator::ArgumentCounter
- Defined in:
- lib/exekutor/asynchronous.rb
Overview
Keeps track of the minimum and maximum number of allowed arguments
Instance Method Summary collapse
- #clear_max ⇒ Object
- #increment(type) ⇒ Object
-
#initialize ⇒ ArgumentCounter
constructor
A new instance of ArgumentCounter.
- #to_range ⇒ Object
Constructor Details
#initialize ⇒ ArgumentCounter
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_max ⇒ Object
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_range ⇒ Object
245 246 247 |
# File 'lib/exekutor/asynchronous.rb', line 245 def to_range @min..@max end |