Class: Metatron::Templates::LimitRange::Limit
- Inherits:
-
Object
- Object
- Metatron::Templates::LimitRange::Limit
- Defined in:
- lib/metatron/templates/limit_range.rb
Overview
Limit is an internal class used to represent the limits in a LimitRange resource, and to provide a consistent interface for rendering them. It is not intended to be used outside of this class. Eventually, it may be used to provide validation for the limits.
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#default_request ⇒ Object
(also: #defaultRequest)
Returns the value of attribute default_request.
-
#max ⇒ Object
Returns the value of attribute max.
-
#max_limit_request_ratio ⇒ Object
(also: #maxLimitRequestRatio)
Returns the value of attribute max_limit_request_ratio.
-
#min ⇒ Object
Returns the value of attribute min.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type:, default: nil, default_request: nil, max: nil, max_limit_request_ratio: nil, min: nil) ⇒ Limit
constructor
A new instance of Limit.
- #render ⇒ Object
Constructor Details
#initialize(type:, default: nil, default_request: nil, max: nil, max_limit_request_ratio: nil, min: nil) ⇒ Limit
Returns a new instance of Limit.
23 24 25 26 27 28 29 30 31 |
# File 'lib/metatron/templates/limit_range.rb', line 23 def initialize(type:, default: nil, default_request: nil, max: nil, max_limit_request_ratio: nil, min: nil) @type = type @default = default @default_request = default_request @max = max @max_limit_request_ratio = max_limit_request_ratio @min = min end |
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
12 13 14 |
# File 'lib/metatron/templates/limit_range.rb', line 12 def default @default end |
#default_request ⇒ Object Also known as: defaultRequest
Returns the value of attribute default_request.
12 13 14 |
# File 'lib/metatron/templates/limit_range.rb', line 12 def default_request @default_request end |
#max ⇒ Object
Returns the value of attribute max.
12 13 14 |
# File 'lib/metatron/templates/limit_range.rb', line 12 def max @max end |
#max_limit_request_ratio ⇒ Object Also known as: maxLimitRequestRatio
Returns the value of attribute max_limit_request_ratio.
12 13 14 |
# File 'lib/metatron/templates/limit_range.rb', line 12 def max_limit_request_ratio @max_limit_request_ratio end |
#min ⇒ Object
Returns the value of attribute min.
12 13 14 |
# File 'lib/metatron/templates/limit_range.rb', line 12 def min @min end |
#type ⇒ Object
Returns the value of attribute type.
12 13 14 |
# File 'lib/metatron/templates/limit_range.rb', line 12 def type @type end |
Class Method Details
.to_limit(limit) ⇒ Object
18 19 20 |
# File 'lib/metatron/templates/limit_range.rb', line 18 def to_limit(limit) limit.is_a?(Limit) ? limit : new(**limit) end |
Instance Method Details
#render ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/metatron/templates/limit_range.rb', line 33 def render { type:, default:, defaultRequest:, max:, maxLimitRequestRatio:, min: }.compact end |