Remove ruby version checks

We're 2.5+ only
This commit is contained in:
Nikita Shilnikov 2021-01-05 21:44:28 +03:00
parent 0ab6328fac
commit 419001cdfa
No known key found for this signature in database
GPG Key ID: E569D1D64C40E241
2 changed files with 2 additions and 16 deletions

View File

@ -95,13 +95,7 @@ module Dry
#
# @api public
def to_ast(meta: true)
opts = if RUBY_VERSION >= "2.5"
options.slice(:type_transform_fn)
else
options.select { |k, _| k == :type_transform_fn }
end
[:hash, [opts, meta ? self.meta : EMPTY_HASH]]
[:hash, [options.slice(:type_transform_fn), meta ? self.meta : EMPTY_HASH]]
end
private

View File

@ -145,18 +145,10 @@ module Dry
#
# @api public
def to_ast(meta: true)
if RUBY_VERSION >= "2.5"
opts = options.slice(:key_transform_fn, :type_transform_fn, :strict)
else
opts = options.select { |k, _|
k == :key_transform_fn || k == :type_transform_fn || k == :strict
}
end
[
:schema,
[keys.map { |key| key.to_ast(meta: meta) },
opts,
options.slice(:key_transform_fn, :type_transform_fn, :strict),
meta ? self.meta : EMPTY_HASH]
]
end