Method: Cure::Helpers::FileHelpers#read_file

Defined in:
lib/cure/helpers/file_helpers.rb

#read_file(file_location) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/cure/helpers/file_helpers.rb', line 24

def read_file(file_location)
  result = file_location.start_with?("/") ? file_location : Pathname.new(file_location)
  # result = file_location.start_with?("/") ? file_location : File.join(File.dirname(__FILE__), file_location)

  raise "No file found at [#{file_location}]" unless File.exist? result.to_s

  File.read(result)
end