Module: Dry::Schema::Extensions::Hints::MessageSetMethods
- Included in:
- MessageSet
- Defined in:
- lib/dry/schema/extensions/hints/message_set_methods.rb
Overview
Hint extensions for MessageSet
Instance Attribute Summary collapse
-
#failures ⇒ Boolean
readonly
Configuration option to enable/disable showing errors.
-
#hints ⇒ Array<Message::Hint>
readonly
Filtered message hints from all messages.
Instance Method Summary collapse
- #initialize(messages, options = EMPTY_HASH) ⇒ Object private
-
#to_h ⇒ Hash<Symbol=>Array<String>>
(also: #to_hash)
Dump message set to a hash with either all messages or just hints.
Instance Attribute Details
#failures ⇒ Boolean (readonly)
Configuration option to enable/disable showing errors
19 20 21 |
# File 'lib/dry/schema/extensions/hints/message_set_methods.rb', line 19 def failures @failures end |
#hints ⇒ Array<Message::Hint> (readonly)
Filtered message hints from all messages
14 15 16 |
# File 'lib/dry/schema/extensions/hints/message_set_methods.rb', line 14 def hints @hints end |
Instance Method Details
#initialize(messages, options = EMPTY_HASH) ⇒ 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.
22 23 24 25 26 |
# File 'lib/dry/schema/extensions/hints/message_set_methods.rb', line 22 def initialize(, = EMPTY_HASH) super @hints = .select(&:hint?) @failures = .fetch(:failures, true) end |
#to_h ⇒ Hash<Symbol=>Array<String>> Also known as: to_hash
Dump message set to a hash with either all messages or just hints
36 37 38 |
# File 'lib/dry/schema/extensions/hints/message_set_methods.rb', line 36 def to_h @to_h ||= failures ? : (hints) end |