class Dry::Schema::Message::Or::SinglePath

Hints extension for Or messages

@see Message::Or

@api public

A message type used by OR operations with the same path

@api public

Attributes

_path[R]

@api private

messages[R]

@api private

path[R]

@api private

Public Class Methods

new(*args, messages) click to toggle source

@api private

Calls superclass method Dry::Schema::Message::Or::Abstract::new
# File lib/dry/schema/message/or/single_path.rb, line 23
def initialize(*args, messages)
  super(*args)
  @messages = messages
  @path = left.path
  @_path = left._path
end

Public Instance Methods

dump() click to toggle source

Dump a message into a string

Both sides of the message will be joined using translated value under `dry_schema.or` message key

@see Message#dump

@return [String]

@api public

# File lib/dry/schema/message/or/single_path.rb, line 40
def dump
  @dump ||= "#{left.dump} #{messages[:or]} #{right.dump}"
end
Also aliased as: to_s
hint?() click to toggle source

@api private

# File lib/dry/schema/extensions/hints.rb, line 27
def hint?
  false
end
to_a() click to toggle source

@api private

# File lib/dry/schema/message/or/single_path.rb, line 57
def to_a
  @to_a ||= [left, right]
end
to_h() click to toggle source

Dump an `or` message into a hash

@see Message#to_h

@return [String]

@api public

# File lib/dry/schema/message/or/single_path.rb, line 52
def to_h
  @to_h ||= _path.to_h(dump)
end
to_s()
Alias for: dump