lib/dry/schema/messages/yaml.rb in dry-schema-1.10.6 vs lib/dry/schema/messages/yaml.rb in dry-schema-1.11.0
- old
+ new
@@ -1,13 +1,11 @@
# frozen_string_literal: true
require "yaml"
require "pathname"
-require "dry/core/equalizer"
require "dry/schema/constants"
-require "dry/schema/messages/abstract"
module Dry
module Schema
module Messages
# Plain YAML message backend
@@ -167,14 +165,12 @@
cache.fetch_or_store(get(key, options).fetch(:text)) do |input|
tokens = input.scan(TOKEN_REGEXP).flatten(1).map(&:to_sym).to_set
text = input.gsub("%", "#")
# rubocop:disable Security/Eval
- # rubocop:disable Style/DocumentDynamicEvalDefinition
evaluator = eval(<<~RUBY, EMPTY_CONTEXT, __FILE__, __LINE__ + 1)
-> (#{tokens.map { |token| "#{token}:" }.join(", ")}) { "#{text}" }
RUBY
- # rubocop:enable Style/DocumentDynamicEvalDefinition
# rubocop:enable Security/Eval
{
tokens: tokens,
evaluator: evaluator