Class: Rufio::FileOpener

Inherits:
Object
  • Object
show all
Defined in:
lib/rufio/file_opener.rb

Instance Method Summary collapse

Constructor Details

#initializeFileOpener

Returns a new instance of FileOpener.



5
6
7
# File 'lib/rufio/file_opener.rb', line 5

def initialize
  @config_loader = ConfigLoader
end

Instance Method Details

#open_directory_in_explorer(directory_path) ⇒ Object



25
26
27
28
29
30
# File 'lib/rufio/file_opener.rb', line 25

def open_directory_in_explorer(directory_path)
  return false unless File.exist?(directory_path)
  return false unless File.directory?(directory_path)

  execute_explorer_command(directory_path)
end

#open_file(file_path) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/rufio/file_opener.rb', line 9

def open_file(file_path)
  return false unless File.exist?(file_path)
  return false if File.directory?(file_path)

  application = find_application_for_file(file_path)
  execute_command(application, file_path)
end

#open_file_with_line(file_path, line_number) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/rufio/file_opener.rb', line 17

def open_file_with_line(file_path, line_number)
  return false unless File.exist?(file_path)
  return false if File.directory?(file_path)

  application = find_application_for_file(file_path)
  execute_command_with_line(application, file_path, line_number)
end