class Builderator::Util::LimitException

Exception raised if a safety limit is exceeded

Constants

DEFAULT_LIMIT

Attributes

resource_name[R]
resources[R]

Public Class Methods

new(resource_name, task, resources) click to toggle source
Calls superclass method
# File lib/builderator/util/limit_exception.rb, line 14
def initialize(resource_name, task, resources)
  super(:limit, task, :yellow)

  @resource_name = resource_name
  @resources = resources
end

Public Instance Methods

count() click to toggle source
# File lib/builderator/util/limit_exception.rb, line 21
def count
  @resources.size
end
limit() click to toggle source
# File lib/builderator/util/limit_exception.rb, line 25
def limit
  Config.cleaner.limits[resource_name]
end
message() click to toggle source
# File lib/builderator/util/limit_exception.rb, line 29
def message
  msg = "Safety limit exceeded for task `#{task}`: Count #{count} is "
  msg << "greater than the limit of #{limit} set in `cleaner.limits.#{resource_name}`. "
  msg << 'Please re-run this task with the --force flag if you are sure this is '\
  'the correct set of resources to delete.' unless Config.cleaner.force

  msg
end