@@ -54,16 +54,21 @@ def failure(message, tokens = EMPTY_HASH)
5454 end
5555 end
5656
57- # @!attribute [r] _context
57+ # @!attribute [r] _contract
5858 # @return [Contract]
5959 # @api private
60- param :_context
60+ param :_contract
6161
6262 # @!attribute [r] keys
6363 # @return [Array<String, Symbol, Hash>]
6464 # @api private
6565 option :keys
6666
67+ # @!attribute [r] _context
68+ # @return [Concurrent::Map]
69+ # @api public
70+ option :_context
71+
6772 # @!attribute [r] path
6873 # @return [Dry::Schema::Path]
6974 # @api private
@@ -79,7 +84,7 @@ def failure(message, tokens = EMPTY_HASH)
7984 # @api private
8085 def initialize ( *args , &block )
8186 super ( *args )
82- instance_eval ( &block )
87+ instance_exec ( _context , &block )
8388 end
8489
8590 # Get failures object for the default or provided path
@@ -120,18 +125,18 @@ def failures
120125
121126 # @api private
122127 def respond_to_missing? ( meth , include_private = false )
123- super || _context . respond_to? ( meth , true )
128+ super || _contract . respond_to? ( meth , true )
124129 end
125130
126131 private
127132
128- # Forward to the underlying context
133+ # Forward to the underlying contract
129134 #
130135 # @api private
131136 def method_missing ( meth , *args , &block )
132137 # yes, we do want to delegate to private methods too
133- if _context . respond_to? ( meth , true )
134- _context . __send__ ( meth , *args , &block )
138+ if _contract . respond_to? ( meth , true )
139+ _contract . __send__ ( meth , *args , &block )
135140 else
136141 super
137142 end
0 commit comments