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.28.0 lib/qonfig/uploaders/json.rb
qonfig-0.27.0 lib/qonfig/uploaders/json.rb
qonfig-0.26.0 lib/qonfig/uploaders/json.rb
qonfig-0.25.0 lib/qonfig/uploaders/json.rb
qonfig-0.24.1 lib/qonfig/uploaders/json.rb
qonfig-0.24.0 lib/qonfig/uploaders/json.rb
qonfig-0.23.0 lib/qonfig/uploaders/json.rb
qonfig-0.22.0 lib/qonfig/uploaders/json.rb
qonfig-0.21.0 lib/qonfig/uploaders/json.rb
qonfig-0.20.0 lib/qonfig/uploaders/json.rb
qonfig-0.19.1 lib/qonfig/uploaders/json.rb
qonfig-0.19.0 lib/qonfig/uploaders/json.rb
qonfig-0.18.1 lib/qonfig/uploaders/json.rb
qonfig-0.18.0 lib/qonfig/uploaders/json.rb
qonfig-0.17.0 lib/qonfig/uploaders/json.rb
qonfig-0.16.0 lib/qonfig/uploaders/json.rb
qonfig-0.15.0 lib/qonfig/uploaders/json.rb
qonfig-0.14.0 lib/qonfig/uploaders/json.rb
qonfig-0.13.0 lib/qonfig/uploaders/json.rb
qonfig-0.12.0 lib/qonfig/uploaders/json.rb