class Crabfarm::Live::ReducerRunner

Public Class Methods

new(_manager, _target) click to toggle source
# File lib/crabfarm/live/reducer_runner.rb, line 8
def initialize(_manager, _target)
  @manager = _manager
  @target = _target
  @rspec = true
  @params = {}
end

Public Instance Methods

clear_params() click to toggle source
# File lib/crabfarm/live/reducer_runner.rb, line 29
def clear_params
  @params = {}
  @rspec = false
end
dsl() click to toggle source
# File lib/crabfarm/live/reducer_runner.rb, line 15
def dsl
  @dsl ||= Dsl.new self
end
execute() click to toggle source
# File lib/crabfarm/live/reducer_runner.rb, line 38
def execute
  strategy = if @rspec
    ReducerRunnerRSpec.new @manager, @target
  else
    ReducerRunnerDirect.new @manager, snapshot, @target, @params
  end

  begin
    Factories::SnapshotReducer.with_decorator decorator do
      strategy.execute
    end

    @manager.show_file decorator.last_path unless decorator.last_path.nil?
    strategy.show_results
  rescue Crabfarm::LiveInterrupted
    Utils::Console.info "Execution interrupted"
  end
end
use_params(_params={}) click to toggle source
# File lib/crabfarm/live/reducer_runner.rb, line 24
def use_params(_params={})
  @params = @params.merge _params
  @rspec = false
end
use_rspec() click to toggle source
# File lib/crabfarm/live/reducer_runner.rb, line 34
def use_rspec
  @rspec = true
end
use_snapshot(_snapshot) click to toggle source
# File lib/crabfarm/live/reducer_runner.rb, line 19
def use_snapshot(_snapshot)
  @snapshot = _snapshot
  @rspec = false
end

Private Instance Methods

decorator() click to toggle source
# File lib/crabfarm/live/reducer_runner.rb, line 59
def decorator
  @decorator ||= DisplayFileDecorator.new @manager
end
snapshot() click to toggle source
# File lib/crabfarm/live/reducer_runner.rb, line 63
def snapshot
  if @snapshot.nil? then snapshot_for(@target) else @snapshot end
end