Class: Nobbie::Wx::Command::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/nobbie/wx/command/executor.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reporter = Reporter.new) ⇒ Executor

Returns a new instance of Executor.



22
23
24
# File 'lib/nobbie/wx/command/executor.rb', line 22

def initialize(reporter = Reporter.new)
  @reporter = reporter
end

Class Method Details

.execute(command) ⇒ Object



10
11
12
# File 'lib/nobbie/wx/command/executor.rb', line 10

def self.execute(command)
  executor.execute(command)
end

.executorObject



14
15
16
# File 'lib/nobbie/wx/command/executor.rb', line 14

def self.executor
  @executor ||= new
end

.reporter=(reporter) ⇒ Object



18
19
20
# File 'lib/nobbie/wx/command/executor.rb', line 18

def self.reporter= reporter
  executor.reporter = reporter
end

Instance Method Details

#execute(command) ⇒ Object



26
27
28
29
30
31
# File 'lib/nobbie/wx/command/executor.rb', line 26

def execute(command)
  @reporter.before_executing_command(command)
  result = command.execute
  @reporter.after_executing_command(result)
  result
end

#reporter=(reporter) ⇒ Object



33
34
35
# File 'lib/nobbie/wx/command/executor.rb', line 33

def reporter= reporter
  @reporter = reporter
end