Class: Operandi::Message
- Inherits:
-
Object
- Object
- Operandi::Message
- Defined in:
- lib/operandi/message.rb
Overview
Represents a single error or warning message.
Instance Attribute Summary collapse
-
#key ⇒ Symbol
readonly
The key/field this message belongs to.
-
#text ⇒ String
readonly
The message text.
Instance Method Summary collapse
-
#break? ⇒ Boolean
Check if this message should stop step execution.
-
#initialize(key, text, opts = {}) ⇒ Message
constructor
Create a new message.
-
#rollback? ⇒ Boolean
Check if this message should trigger a transaction rollback.
-
#to_s ⇒ String
Return the message text.
Constructor Details
#initialize(key, text, opts = {}) ⇒ Message
Create a new message.
25 26 27 28 29 |
# File 'lib/operandi/message.rb', line 25 def initialize(key, text, opts = {}) @key = key @text = text @opts = opts end |
Instance Attribute Details
#key ⇒ Symbol (readonly)
Returns the key/field this message belongs to.
13 14 15 |
# File 'lib/operandi/message.rb', line 13 def key @key end |
#text ⇒ String (readonly)
Returns the message text.
16 17 18 |
# File 'lib/operandi/message.rb', line 16 def text @text end |
Instance Method Details
#break? ⇒ Boolean
Check if this message should stop step execution.
34 35 36 |
# File 'lib/operandi/message.rb', line 34 def break? @opts[:break] end |
#rollback? ⇒ Boolean
Check if this message should trigger a transaction rollback.
41 42 43 |
# File 'lib/operandi/message.rb', line 41 def rollback? @opts[:rollback] end |
#to_s ⇒ String
Return the message text.
48 49 50 |
# File 'lib/operandi/message.rb', line 48 def to_s text end |