Sha256: 347a9db721c9cfcdab1263a09597c429c86f3e8be0fa6f85e5e6fa4b373d5bd1
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
# frozen_string_literal: true module Arstotzka # @api public # # Arstotzka configuration # # Configuration is # # @see https://www.rubydoc.info/gems/sinclair/1.4.0/Sinclair/Config Sinclair::Config # # @example (see #options) class Config < Sinclair::Config DEFAULT_CONFIGS = { after: false, after_each: nil, cached: false, case: :lower_camel, compact: false, default: nil, flatten: false, json: :json, klass: nil, type: :none }.freeze add_configs DEFAULT_CONFIGS # @api private # # Returns a new instance of {Options} # # the new instance will have it's values as a merge # from configuration and given options_hash # # @param options_hash [Hash] options override # # @return [Options] # # @example Generating options # Arstotzka.configure do |config| # config.case :snake # end # # config = Arstotzka.config # options = config.options(klass: Person) # # options.to_h # # returns # # { # # after: false, # # after_each: nil, # # cached: false, # # case: :snake, # # compact: false, # # default: nil, # # flatten: false, # # json: :json, # # klass: Person, # # type: :none # # } def options(options_hash = {}) Options.new( to_hash.symbolize_keys.merge( options_hash.symbolize_keys ) ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arstotzka-1.4.0 | lib/arstotzka/config.rb |