Sha256: 103897c95b6352d365c0b84c7db95b2c2e167914c5a7803bb74c30338f0e51fb

Contents?: true

Size: 527 Bytes

Versions: 5

Compression:

Stored size: 527 Bytes

Contents

module I18n::Tasks::Scanners::Files
  # Reads the files in 'rb' mode and UTF-8 encoding.
  #
  # @since 0.9.0
  class FileReader

    # Return the contents of the file at the given path.
    # The file is read in the 'rb' mode and UTF-8 encoding.
    #
    # @param path [String] Path to the file, absolute or relative to the working directory.
    # @return [String] file contents
    def read_file(path)
      result = nil
      File.open(path, 'rb', encoding: 'UTF-8') { |f| result = f.read }
      result
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
i18n-tasks-0.9.2 lib/i18n/tasks/scanners/files/file_reader.rb
i18n-tasks-0.9.1 lib/i18n/tasks/scanners/files/file_reader.rb
i18n-tasks-0.9.0 lib/i18n/tasks/scanners/files/file_reader.rb
i18n-tasks-0.9.0.rc2 lib/i18n/tasks/scanners/files/file_reader.rb
i18n-tasks-0.9.0.rc1 lib/i18n/tasks/scanners/files/file_reader.rb