lib/tarquinn/condition/proc_runner.rb in tarquinn-0.2.0 vs lib/tarquinn/condition/proc_runner.rb in tarquinn-0.3.0

- old
+ new

@@ -1,11 +1,22 @@ -class Tarquinn::Condition::ProcRunner - attr_reader :block +# frozen_string_literal: true - def initialize(&block) - @block = block - end +module Tarquinn + class Condition + # @api private + # + # Checks condition based on a given block + class ProcRunner < Tarquinn::Condition + def initialize(&block) + @block = block + end - def check?(controller) - block.yield(controller) + def check?(controller) + controller.run(&block) + end + + private + + attr_reader :block + end end end