lib/arstotzka/options.rb in arstotzka-1.3.2 vs lib/arstotzka/options.rb in arstotzka-1.4.0
- old
+ new
@@ -3,12 +3,11 @@
module Arstotzka
# @api private
#
# Class responsible to hold the options
#
- # Options is initialized and merged with {DEFAULT_OPTIONS}
- # when using {ClassMethods#expose}
+ # Options is initialized when using {ClassMethods#expose}
#
# @example Using options klass and after
# class Customer
# attr_reader :name, :age
#
@@ -243,32 +242,15 @@
# # John Bobby Maria
# # Danny LJ Robert Richard
# # Linda Ariel
# # ]
class Options < ::OpenStruct
- DEFAULT_OPTIONS = {
- after: false,
- after_each: nil,
- cached: false,
- case: :lower_camel,
- compact: false,
- default: nil,
- flatten: false,
- full_path: nil,
- json: :json,
- klass: nil,
- path: nil,
- type: :none
- }.freeze
-
# Creates a new instance of Options
#
# @param options [Hash] options hash
+ # Options hash are initialized when using {ClassMethods#expose}
#
- # Options hash are initialized and merged with {DEFAULT_OPTIONS}
- # when using {ClassMethods#expose}
- #
# @option options [String,Symbol] after: {Fetcher} option with the name of the method to be
# called once the value is fetched for mapping the value
#
# @option options [String,Symbol] after_each: {Wrapper} option with method that will be called
# on each individual result (while after is called on the whole collection)
@@ -302,10 +284,10 @@
def initialize(options)
klass = options.delete(:class)
warn ":class has been deprecated, prefer 'expose klass: #{klass}'" if klass
options[:klass] ||= klass
- super(DEFAULT_OPTIONS.merge(options))
+ super(options)
end
# @private
#
# Creates a new instance mergin the given hash with @options