Exception: Builderator::Util::LimitException
- Inherits:
-
TaskException
- Object
- StandardError
- TaskException
- Builderator::Util::LimitException
- Defined in:
- lib/builderator/util/limit_exception.rb
Overview
Exception raised if a safety limit is exceeded
Instance Attribute Summary collapse
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Attributes inherited from TaskException
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(klass, task, resources) ⇒ LimitException
constructor
A new instance of LimitException.
- #limit ⇒ Object
- #message ⇒ Object
- #resource ⇒ Object
Constructor Details
#initialize(klass, task, resources) ⇒ LimitException
Returns a new instance of LimitException.
11 12 13 14 15 16 |
# File 'lib/builderator/util/limit_exception.rb', line 11 def initialize(klass, task, resources) super(:limit, task, :yellow) @klass = klass @resources = resources end |
Instance Attribute Details
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
9 10 11 |
# File 'lib/builderator/util/limit_exception.rb', line 9 def resources @resources end |
Instance Method Details
#count ⇒ Object
18 19 20 |
# File 'lib/builderator/util/limit_exception.rb', line 18 def count @resources.size end |
#limit ⇒ Object
22 23 24 |
# File 'lib/builderator/util/limit_exception.rb', line 22 def limit @klass::LIMIT end |
#message ⇒ Object
30 31 32 33 34 35 |
# File 'lib/builderator/util/limit_exception.rb', line 30 def "Safety limit exceeded for task `#{ task }`: Count #{ count } is"\ " greater than the limit of #{ limit } set in #{ resource }. Please"\ " re-run this task with the --no-limit flag if you are sure this is"\ " the correct set of resources to delete." end |
#resource ⇒ Object
26 27 28 |
# File 'lib/builderator/util/limit_exception.rb', line 26 def resource @klass.name end |