Class: Qonfig::Loaders::JSON Private

Inherits:
Basic
  • Object
show all
Defined in:
lib/qonfig/loaders/json.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.5.0

Class Method Summary collapse

Methods inherited from Basic

load_file

Class Method Details

.load(data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • data (String)

Returns:

  • (Object)

Raises:

Since:

  • 0.5.0

Version:

  • 0.26.0



15
16
17
18
19
20
21
# File 'lib/qonfig/loaders/json.rb', line 15

def load(data)
  ::JSON.parse(ERB.new(data).result, 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

.load_empty_dataObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Object)

Since:

  • 0.5.0



27
28
29
# File 'lib/qonfig/loaders/json.rb', line 27

def load_empty_data
  load('{}')
end