class Bail::ConditionTester

Attributes

type[RW]

Public Class Methods

new(type) click to toggle source
# File lib/bail/condition_tester.rb, line 9
def initialize(type)
  # can be methods from Enumerable basically
  #  i.e. :any?, :all?
  @type = questionable(type)
end

Public Instance Methods

run(condition_parser, objects) click to toggle source
# File lib/bail/condition_tester.rb, line 15
def run(condition_parser, objects)
  if objects.send(type) {|object| condition_parser.test(object)}
    raise Bail::ConditionError.new('A Bail condition has failed.')
  end
end