Sha256: b738655dc404c3b8e5cf330c4a0c9e09d688c15a6e13b80c12e00c38b24c3732

Contents?: true

Size: 669 Bytes

Versions: 12

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true

# @api private
# @since 0.5.0
class Qonfig::Loaders::JSON < Qonfig::Loaders::Basic
  class << self
    # @param data [String]
    # @return [Object]
    #
    # @raise [Qonfig::JSONLoaderParseError]
    #
    # @api private
    # @since 0.5.0
    def load(data)
      ::JSON.parse(data, max_nesting: false, allow_nan: true)
    rescue ::JSON::ParserError => error
      raise(Qonfig::JSONLoaderParseError.new(error.message).tap do |exception|
        exception.set_backtrace(error.backtrace)
      end)
    end

    # @return [Object]
    #
    # @api private
    # @since 0.5.0
    def load_empty_data
      load('{}')
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
qonfig-0.25.0 lib/qonfig/loaders/json.rb
qonfig-0.24.1 lib/qonfig/loaders/json.rb
qonfig-0.24.0 lib/qonfig/loaders/json.rb
qonfig-0.23.0 lib/qonfig/loaders/json.rb
qonfig-0.22.0 lib/qonfig/loaders/json.rb
qonfig-0.21.0 lib/qonfig/loaders/json.rb
qonfig-0.20.0 lib/qonfig/loaders/json.rb
qonfig-0.19.1 lib/qonfig/loaders/json.rb
qonfig-0.19.0 lib/qonfig/loaders/json.rb
qonfig-0.18.1 lib/qonfig/loaders/json.rb
qonfig-0.18.0 lib/qonfig/loaders/json.rb
qonfig-0.17.0 lib/qonfig/loaders/json.rb