Class: Dry::Schema::MessageCompiler::VisitorOpts Private
- Inherits:
-
Hash
- Object
- Hash
- Dry::Schema::MessageCompiler::VisitorOpts
- Defined in:
- lib/dry/schema/message_compiler/visitor_opts.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Optimized option hash used by visitor methods in message compiler
Class Method Summary collapse
- .new ⇒ Object private
Instance Method Summary collapse
- #call(other) ⇒ Object private
- #current_messages ⇒ Object private
- #dup(current_messages = EMPTY_ARRAY.dup) ⇒ Object private
- #failures ⇒ Object private
- #hints ⇒ Object private
- #key_failure?(path) ⇒ Boolean private
- #path ⇒ Object private
Class Method Details
.new ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 14 def self.new opts = super opts[:path] = EMPTY_ARRAY opts[:message_type] = :failure opts[:current_messages] = EMPTY_ARRAY.dup opts end |
Instance Method Details
#call(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 28 def call(other) merge(other.update(path: [*path, *other[:path]])) end |
#current_messages ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 50 def self[:current_messages] end |
#dup(current_messages = EMPTY_ARRAY.dup) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 36 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 32 def dup( = EMPTY_ARRAY.dup) opts = super() opts[:current_messages] = opts end |
#failures ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 42 def failures .reject(&:hint?) end |
#hints ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 46 def hints .select(&:hint?) end |
#key_failure?(path) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 38 def key_failure?(path) failures.any? { |f| f.path == path && f.predicate.equal?(:key?) } end |
#path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 23 def path self[:path] end |