Class: Superfeature::Limit::Hard
Direct Known Subclasses
Instance Attribute Summary collapse
-
#maximum ⇒ Object
Returns the value of attribute maximum.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #exceeded? ⇒ Boolean
-
#initialize(quantity:, maximum:) ⇒ Hard
constructor
A new instance of Hard.
- #remaining ⇒ Object
Methods inherited from Base
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
#maximum ⇒ Object
Returns the value of attribute maximum.
33 34 35 |
# File 'lib/superfeature.rb', line 33 def maximum @maximum end |
#quantity ⇒ Object
Returns the value of attribute quantity.
33 34 35 |
# File 'lib/superfeature.rb', line 33 def quantity @quantity end |
Instance Method Details
#exceeded? ⇒ Boolean
44 45 46 |
# File 'lib/superfeature.rb', line 44 def exceeded? quantity > maximum if quantity and maximum end |
#remaining ⇒ Object
40 41 42 |
# File 'lib/superfeature.rb', line 40 def remaining maximum - quantity end |