Class: Superfeature::Limit::Hard

Inherits:
Base
  • Object
show all
Defined in:
lib/superfeature.rb

Direct Known Subclasses

Soft

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#disabled?

Constructor Details

#initialize(quantity:, maximum:) ⇒ Hard

Returns a new instance of Hard.



35
36
37
38
# File 'lib/superfeature.rb', line 35

def initialize(quantity: , maximum: )
  @quantity = quantity
  @maximum = maximum
end

Instance Attribute Details

#maximumObject

Returns the value of attribute maximum.



33
34
35
# File 'lib/superfeature.rb', line 33

def maximum
  @maximum
end

#quantityObject

Returns the value of attribute quantity.



33
34
35
# File 'lib/superfeature.rb', line 33

def quantity
  @quantity
end

Instance Method Details

#enabled?Boolean

Returns:



48
49
50
# File 'lib/superfeature.rb', line 48

def enabled?
  not exceeded?
end

#exceeded?Boolean

Returns:



44
45
46
# File 'lib/superfeature.rb', line 44

def exceeded?
  quantity > maximum if quantity and maximum
end

#remainingObject



40
41
42
# File 'lib/superfeature.rb', line 40

def remaining
  maximum - quantity
end