Skip to content

Commit

Permalink
Use compatibility shim for Config.setting
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed May 27, 2021
1 parent 5ff1883 commit c8ad125
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/dry/validation/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ module Validation
#
# @api public
class Config < Schema::Config
if Dry::Configurable::VERSION < "0.13"
setting :macros, Macros::Container.new, constructor: :dup.to_proc
else
setting :macros, default: Macros::Container.new, constructor: :dup.to_proc
unless Dry::Configurable::VERSION < "0.13"
def self.setting(name, default = Undefined, **opts, &block)
return super if default.equal?(Undefined)
super(name, **opts.merge(default: default), &block)
end
end

setting :macros, Macros::Container.new, constructor: :dup.to_proc

# @api private
def dup
config = super
Expand Down

0 comments on commit c8ad125

Please sign in to comment.