Class: Watchcat::CLI::ActionExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/watchcat/cli/action_executor.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_path, event) ⇒ ActionExecutor

Returns a new instance of ActionExecutor.



4
5
6
7
8
9
10
11
# File 'lib/watchcat/cli/action_executor.rb', line 4

def initialize(file_path, event)
  @file_path = file_path
  @event = event
  @file_dir = File.dirname(file_path)
  @file_name = File.basename(file_path)
  @file_ext = File.extname(file_path)
  @file_base = File.basename(file_path, @file_ext)
end

Instance Method Details

#execute(action) ⇒ Object



13
14
15
16
17
# File 'lib/watchcat/cli/action_executor.rb', line 13

def execute(action)
  execute_command(action)
rescue => e
  puts "Error executing action #{action}: #{e.message}"
end