Sha256: c4edd742f3ffdb2f21d97e190e65fb6910536ef351d4cc71760b8a6b005d6205

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

# @api private
# @since 0.11.0
class Qonfig::Uploaders::File < Qonfig::Uploaders::Base
  # @return [String]
  #
  # @api private
  # @since 0.11.0
  FILE_OPENING_MODE = 'w'

  # @return [String]
  #
  # @api private
  # @since 0.11.0
  EMPTY_SETTINGS_REPRESENTATION = ''

  # @return [Hash]
  #
  # @api private
  # @since 0.11.0
  DEFAULT_OPTIONS = {}.freeze

  class << self
    # @param settings [Qonfig::Settings]
    # @param value_processor [Block]
    # @option path [String, Pathname]
    # @option options [Hash<Symbol|String,Any>]
    # @return [void]
    #
    # @api private
    # @since 0.11.0
    def upload(settings, path:, options: self::DEFAULT_OPTIONS, &value_processor)
      ::File.open(path, FILE_OPENING_MODE) do |file_descriptor|
        settings_representation = represent_settings(settings, options, &value_processor)
        file_descriptor.write(settings_representation)
      end
    end

    private

    # @param settings [Qonfig::Settings]
    # @param options [Hash<Symbol|String,Any>]
    # @param value_processor [Block]
    # @return [String]
    #
    # @api private
    # @since 0.11.0
    def represent_settings(settings, options, &value_processor)
      # :nocov:
      EMPTY_SETTINGS_REPRESENTATION
      # :nocov:
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
qonfig-0.28.0 lib/qonfig/uploaders/file.rb
qonfig-0.27.0 lib/qonfig/uploaders/file.rb
qonfig-0.26.0 lib/qonfig/uploaders/file.rb
qonfig-0.25.0 lib/qonfig/uploaders/file.rb
qonfig-0.24.1 lib/qonfig/uploaders/file.rb
qonfig-0.24.0 lib/qonfig/uploaders/file.rb
qonfig-0.23.0 lib/qonfig/uploaders/file.rb