lib/mihari/schemas/macros.rb in mihari-5.6.2 vs lib/mihari/schemas/macros.rb in mihari-5.7.0
- old
+ new
@@ -1,9 +1,13 @@
# frozen_string_literal: true
module Dry
module Schema
module Macros
+ #
+ # Macros DSL for options with default values
+ # (see https://github.com/dry-rb/dry-schema/issues/70)
+ #
class DSL
def default(value)
schema_dsl.before(:rule_applier) do |result|
result.update(name => value) unless result[name]
end