Module: Dry::Schema::Extensions::Hints::MessageSetMethods

Included in:
MessageSet
Defined in:
lib/dry/schema/extensions/hints/message_set_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#failuresObject (readonly)

Returns the value of attribute failures.



8
9
10
# File 'lib/dry/schema/extensions/hints/message_set_methods.rb', line 8

def failures
  @failures
end

#hintsObject (readonly)

Returns the value of attribute hints.



8
9
10
# File 'lib/dry/schema/extensions/hints/message_set_methods.rb', line 8

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.



11
12
13
14
15
# File 'lib/dry/schema/extensions/hints/message_set_methods.rb', line 11

def initialize(messages, options = EMPTY_HASH)
  super
  @hints = messages.select(&:hint?)
  @failures = options.fetch(:failures, true)
end

#to_hObject Also known as: to_hash



18
19
20
# File 'lib/dry/schema/extensions/hints/message_set_methods.rb', line 18

def to_h
  failures ? messages_map : messages_map(hints)
end