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.
15 16 17 18 19 20 21 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 15 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.
29 30 31 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 29 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.
51 52 53 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 51 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.
33 34 35 36 37 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 33 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.
43 44 45 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 43 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.
47 48 49 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 47 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.
39 40 41 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 39 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.
24 25 26 |
# File 'lib/dry/schema/message_compiler/visitor_opts.rb', line 24 def path self[:path] end |