Class: Dry::Schema::Message
- Inherits:
-
Object
- Object
- Dry::Schema::Message
- Defined in:
- lib/dry/schema/message.rb
Overview
Message objects used by message sets
Direct Known Subclasses
Defined Under Namespace
Classes: Or
Instance Attribute Summary collapse
- #args ⇒ Object readonly
- #options ⇒ Object readonly
- #path ⇒ Object readonly
- #predicate ⇒ Object readonly
- #rule ⇒ Object readonly
- #text ⇒ Object readonly
Class Method Summary collapse
-
.[](predicate, path, text, options) ⇒ Object
private
Build a new message object.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean private
- #hint? ⇒ Boolean private
-
#initialize(predicate, path, text, options) ⇒ Message
constructor
private
A new instance of Message.
-
#to_s ⇒ Object
Return a string representation of the message.
Constructor Details
#initialize(predicate, path, text, options) ⇒ Message
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 Message.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/dry/schema/message.rb', line 58 def initialize(predicate, path, text, ) @predicate = predicate @path = path.dup @text = text = @rule = [:rule] @args = [:args] || EMPTY_ARRAY if predicate == :key? @path << rule end end |
Instance Attribute Details
#args ⇒ Object (readonly)
11 12 13 |
# File 'lib/dry/schema/message.rb', line 11 def args @args end |
#options ⇒ Object (readonly)
11 12 13 |
# File 'lib/dry/schema/message.rb', line 11 def end |
#path ⇒ Object (readonly)
11 12 13 |
# File 'lib/dry/schema/message.rb', line 11 def path @path end |
#predicate ⇒ Object (readonly)
11 12 13 |
# File 'lib/dry/schema/message.rb', line 11 def predicate @predicate end |
#rule ⇒ Object (readonly)
11 12 13 |
# File 'lib/dry/schema/message.rb', line 11 def rule @rule end |
#text ⇒ Object (readonly)
11 12 13 |
# File 'lib/dry/schema/message.rb', line 11 def text @text end |
Class Method Details
.[](predicate, path, text, options) ⇒ 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.
Build a new message object
53 54 55 |
# File 'lib/dry/schema/message.rb', line 53 def self.[](predicate, path, text, ) Message.new(predicate, path, text, ) end |
Instance Method Details
#eql?(other) ⇒ 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.
84 85 86 |
# File 'lib/dry/schema/message.rb', line 84 def eql?(other) other.is_a?(String) ? text == other : super 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.
79 80 81 |
# File 'lib/dry/schema/message.rb', line 79 def hint? false end |
#to_s ⇒ Object
Return a string representation of the message
74 75 76 |
# File 'lib/dry/schema/message.rb', line 74 def to_s text end |