module Dry::Schema::Extensions::Hints::MessageSetMethods

Hint extensions for MessageSet

@api public

Attributes

failures[R]

Configuration option to enable/disable showing errors

@return [Boolean]

hints[R]

Filtered message hints from all messages

@return [Array<Message::Hint>]

Public Class Methods

new(messages, options = EMPTY_HASH) click to toggle source

@api private

Calls superclass method
# File lib/dry/schema/extensions/hints/message_set_methods.rb, line 22
def initialize(messages, options = EMPTY_HASH)
  super
  @hints = messages.select(&:hint?)
  @failures = options.fetch(:failures, true)
end

Public Instance Methods

to_h() click to toggle source

Dump message set to a hash with either all messages or just hints

@see MessageSet#to_h @see ResultMethods#hints

@return [Hash<Symbol=>Array<String>>]

@api public

# File lib/dry/schema/extensions/hints/message_set_methods.rb, line 36
def to_h
  @to_h ||= failures ? messages_map : messages_map(hints)
end
Also aliased as: to_hash
to_hash()
Alias for: to_h