Sha256: 2774331f9cc1e110692a470454d3dfdacfa547d21d17db82cde836459d9b7f5d

Contents?: true

Size: 556 Bytes

Versions: 6

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true
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

6 entries across 6 versions & 1 rubygems

Version Path
i18n-tasks-0.9.12 lib/i18n/tasks/scanners/files/file_reader.rb
i18n-tasks-0.9.11 lib/i18n/tasks/scanners/files/file_reader.rb
i18n-tasks-0.9.10 lib/i18n/tasks/scanners/files/file_reader.rb
i18n-tasks-0.9.9 lib/i18n/tasks/scanners/files/file_reader.rb
i18n-tasks-0.9.8 lib/i18n/tasks/scanners/files/file_reader.rb
i18n-tasks-0.9.7 lib/i18n/tasks/scanners/files/file_reader.rb