Class: Liquid::ResourceLimits
- Inherits:
-
Object
- Object
- Liquid::ResourceLimits
- Defined in:
- lib/liquid/resource_limits.rb
Instance Attribute Summary collapse
-
#assign_score ⇒ Object
Returns the value of attribute assign_score.
-
#assign_score_limit ⇒ Object
Returns the value of attribute assign_score_limit.
-
#render_length ⇒ Object
Returns the value of attribute render_length.
-
#render_length_limit ⇒ Object
Returns the value of attribute render_length_limit.
-
#render_score ⇒ Object
Returns the value of attribute render_score.
-
#render_score_limit ⇒ Object
Returns the value of attribute render_score_limit.
Instance Method Summary collapse
-
#initialize(limits) ⇒ ResourceLimits
constructor
A new instance of ResourceLimits.
- #reached? ⇒ Boolean
- #reset ⇒ Object
Constructor Details
#initialize(limits) ⇒ ResourceLimits
Returns a new instance of ResourceLimits.
6 7 8 9 10 11 |
# File 'lib/liquid/resource_limits.rb', line 6 def initialize(limits) @render_length_limit = limits[:render_length_limit] @render_score_limit = limits[:render_score_limit] @assign_score_limit = limits[:assign_score_limit] reset end |
Instance Attribute Details
#assign_score ⇒ Object
Returns the value of attribute assign_score.
3 4 5 |
# File 'lib/liquid/resource_limits.rb', line 3 def assign_score @assign_score end |
#assign_score_limit ⇒ Object
Returns the value of attribute assign_score_limit.
3 4 5 |
# File 'lib/liquid/resource_limits.rb', line 3 def assign_score_limit @assign_score_limit end |
#render_length ⇒ Object
Returns the value of attribute render_length.
3 4 5 |
# File 'lib/liquid/resource_limits.rb', line 3 def render_length @render_length end |
#render_length_limit ⇒ Object
Returns the value of attribute render_length_limit.
3 4 5 |
# File 'lib/liquid/resource_limits.rb', line 3 def render_length_limit @render_length_limit end |
#render_score ⇒ Object
Returns the value of attribute render_score.
3 4 5 |
# File 'lib/liquid/resource_limits.rb', line 3 def render_score @render_score end |
#render_score_limit ⇒ Object
Returns the value of attribute render_score_limit.
3 4 5 |
# File 'lib/liquid/resource_limits.rb', line 3 def render_score_limit @render_score_limit end |
Instance Method Details
#reached? ⇒ Boolean
13 14 15 16 17 |
# File 'lib/liquid/resource_limits.rb', line 13 def reached? (@render_length_limit && @render_length > @render_length_limit) || (@render_score_limit && @render_score > @render_score_limit) || (@assign_score_limit && @assign_score > @assign_score_limit) end |
#reset ⇒ Object
19 20 21 |
# File 'lib/liquid/resource_limits.rb', line 19 def reset @render_length = @render_score = @assign_score = 0 end |