Class: EasyRspec::FilePathFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_rspec/file_path_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass_name) ⇒ FilePathFinder

Returns a new instance of FilePathFinder.



5
6
7
# File 'lib/easy_rspec/file_path_finder.rb', line 5

def initialize(klass_name)
  @klass_name = klass_name
end

Instance Method Details

#file_pathObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/easy_rspec/file_path_finder.rb', line 9

def file_path
  file_path = if matching_file_paths.one?
    matching_file_paths.first
  elsif matching_file_paths.size > 1
    user_selected_file
  else
    nil
  end
  raise "File path not found" unless file_path
  file_path
end