Class: Guard::Teabag::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/teabag/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Runner

Returns a new instance of Runner.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/guard/teabag/runner.rb', line 7

def initialize(options = {})
  @options = options

  begin
    require "teabag/console"
    @console = ::Teabag::Console.new(@options)
  rescue ::Teabag::EnvironmentNotFound => e
    STDOUT.print "Unable to load Teabag environment in {#{::Teabag::Environment.standard_environments.join(', ')}}.\n"
    STDOUT.print "Consider using -r path/to/teabag_env\n"
    abort
  end
end

Instance Attribute Details

#consoleObject

Returns the value of attribute console.



5
6
7
# File 'lib/guard/teabag/runner.rb', line 5

def console
  @console
end

Instance Method Details

#run(files = [], options = {}) ⇒ Object



24
25
26
27
# File 'lib/guard/teabag/runner.rb', line 24

def run(files = [], options = {})
  return false if files.empty?
  @console.execute(@options.merge(options), files)
end

#run_all(options = {}) ⇒ Object



20
21
22
# File 'lib/guard/teabag/runner.rb', line 20

def run_all(options = {})
  @console.execute(@options.merge(options))
end