lib/dry/schema/macros/filled.rb in dry-schema-1.1.0 vs lib/dry/schema/macros/filled.rb in dry-schema-1.2.0
- old
+ new
@@ -18,16 +18,12 @@
# @api private
def call(*predicates, **opts, &block)
ensure_valid_predicates(predicates)
- if opts[:type_spec]
- if filter?
- value(*predicates, **opts, &block)
- else
- value(predicates[0], :filled?, *predicates[1..predicates.size - 1], **opts, &block)
- end
+ if opts[:type_spec] && !filter_empty_string?
+ value(predicates[0], :filled?, *predicates[1..predicates.size - 1], **opts, &block)
else
value(:filled?, *predicates, **opts, &block)
end
end
@@ -43,20 +39,20 @@
end
end
# rubocop:enable Style/GuardClause
# @api private
- def filter?
- !primitives.include?(NilClass) && processor_config.filter_empty_string
+ def filter_empty_string?
+ !expected_primitives.include?(NilClass) && processor_config.filter_empty_string
end
# @api private
def processor_config
schema_dsl.processor_type.config
end
# @api private
- def primitives
+ def expected_primitives
primitive_inferrer[schema_type]
end
# @api private
def schema_type