Method: Glyph::Utils#file_load

Defined in:
lib/glyph/utils.rb

#file_load(file) ⇒ String

Loads the contents of a file

Parameters:

  • file (#to_s)

    the file to load

Returns:

  • (String)

    the contents of the file

Since:

  • 0.4.0

[View source]

54
55
56
57
58
59
60
61
62
# File 'lib/glyph/utils.rb', line 54

def file_load(file)
  result = ""
  File.open(file.to_s, 'r:utf-8') do |f|
    while l = f.gets 
      result << l
    end
  end
  result
end