Module: Fdlint::Helper::FileReader
Instance Method Summary collapse
-
#readfile(path, opt = {}) ⇒ Object
auto detect file encoding and read it.
Instance Method Details
#readfile(path, opt = {}) ⇒ Object
auto detect file encoding and read it. return with an array containing string and encoding
11 12 13 14 15 |
# File 'lib/fdlint/helper/file_reader.rb', line 11 def readfile(path, opt={}) bin = File.read(path).utf8! raise EncodingError.new unless bin.valid_encoding? bin end |