class RSpec::ComposableJSONMatchers::Configuration

Constants

DEFAULT_PARSER_OPTIONS

@api public

The default value of .parser_options.

@see parser_options

Public Instance Methods

parser_options() click to toggle source

@api public

Returns the current options for JSON.parse used in the `be_json` matcher.

@return [Hash] the current options for JSON.parse.

@see parser_options= @see ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-parse

# File lib/rspec/composable_json_matchers/configuration.rb, line 19
def parser_options
  @parser_options ||= DEFAULT_PARSER_OPTIONS
end
parser_options=(hash) click to toggle source

@api public

Set the given hash as the option for JSON.parse used in the `be_json` matcher.

@param hash [Hash] an option for JSON.parse

@return [void]

@see parser_options @see ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-parse

# File lib/rspec/composable_json_matchers/configuration.rb, line 33
def parser_options=(hash)
  raise ArgumentError, 'You must pass a hash to `parser_options=`.' unless hash.is_a?(Hash)
  @parser_options = hash
end