Method: StringInFile.read

Defined in:
lib/string_in_file.rb

.read(path) ⇒ Object

Put contents of file into string Thanks to Keith R. Bennett for suggesting this solution on ruby.mn. Please note that newlines are removed. Thus, this is designed to work with 1-line strings.



9
10
11
12
# File 'lib/string_in_file.rb', line 9

def self.read(path)
  str_output = File.readlines(path).join('')
  str_output = str_output.delete("\n")
end