Sha256: 41d15f23fedd4f1523484e64a8f096c19e088eab24affb371f07f4f30237b08b

Contents?: true

Size: 773 Bytes

Versions: 21

Compression:

Stored size: 773 Bytes

Contents

# frozen_string_literal: true

# @api private
# @since 0.11.0
class Qonfig::Uploaders::JSON < Qonfig::Uploaders::File
  # @return [Hash<Symbol,Any>]
  #
  # @api private
  # @since 0.11.0
  DEFAULT_OPTIONS = {
    indent: ' ',
    space: ' ',
    object_nl: "\n"
  }.freeze

  class << self
    # @param settings [Qonfig::Settings]
    # @param options [Hash<Symbol,Any>]
    # @param value_processor [Block]
    # @return [String]
    #
    # @api private
    # @since 0.11.0
    def represent_settings(settings, options, &value_processor)
      settings_hash =
        if block_given?
          settings.__to_hash__(transform_value: value_processor)
        else
          settings.__to_hash__
        end

      ::JSON.generate(settings_hash, options)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
qonfig-0.11.0 lib/qonfig/uploaders/json.rb