Class: Dry::Schema::Message::Or

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/dry/schema/message.rb,
lib/dry/schema/extensions/hints.rb

Overview

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, right, messages) ⇒ Or

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.

Returns a new instance of Or.



35
36
37
38
39
40
# File 'lib/dry/schema/message.rb', line 35

def initialize(left, right, messages)
  @left = left
  @right = right
  @messages = messages
  @path = left.path
end

Instance Attribute Details

#leftObject (readonly)

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.



23
24
25
# File 'lib/dry/schema/message.rb', line 23

def left
  @left
end

#messagesObject (readonly)

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.



32
33
34
# File 'lib/dry/schema/message.rb', line 32

def messages
  @messages
end

#pathObject (readonly)

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.rb', line 29

def path
  @path
end

#rightObject (readonly)

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.



26
27
28
# File 'lib/dry/schema/message.rb', line 26

def right
  @right
end

Instance Method Details

#each(&block) ⇒ 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.



50
51
52
# File 'lib/dry/schema/message.rb', line 50

def each(&block)
  to_a.each(&block)
end

#hint?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.

Returns:

  • (Boolean)


23
24
25
# File 'lib/dry/schema/extensions/hints.rb', line 23

def hint?
  false
end

#to_aObject

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.



55
56
57
# File 'lib/dry/schema/message.rb', line 55

def to_a
  [left, right]
end

#to_sObject

Return a string representation of the message



45
46
47
# File 'lib/dry/schema/message.rb', line 45

def to_s
  uniq.join(" #{messages[:or]} ")
end