Class: I18n::Tasks::Scanners::Files::FileReader
- Inherits:
-
Object
- Object
- I18n::Tasks::Scanners::Files::FileReader
- Defined in:
- lib/i18n/tasks/scanners/files/file_reader.rb
Overview
Reads the files in ‘rb’ mode and UTF-8 encoding.
Direct Known Subclasses
Instance Method Summary collapse
-
#read_file(path) ⇒ String
Return the contents of the file at the given path.
Instance Method Details
#read_file(path) ⇒ String
Return the contents of the file at the given path. The file is read in the ‘rb’ mode and UTF-8 encoding.
13 14 15 16 17 |
# File 'lib/i18n/tasks/scanners/files/file_reader.rb', line 13 def read_file(path) result = nil File.open(path, 'rb', encoding: 'UTF-8') { |f| result = f.read } result end |