Method: String#read_file

Defined in:
lib/na/string.rb

#read_fileObject



38
39
40
41
42
43
44
# File 'lib/na/string.rb', line 38

def read_file
  file = File.expand_path(self)
  raise "Missing file #{file}" unless File.exist?(file)

  # IO.read(file).force_encoding('ASCII-8BIT').encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
  IO.read(file).force_encoding('utf-8')
end