Class: Raakt::ErrorMessage
- Inherits:
-
Object
- Object
- Raakt::ErrorMessage
- Defined in:
- lib/raakt.rb
Instance Attribute Summary collapse
-
#eid ⇒ Object
readonly
Returns the value of attribute eid.
-
#note ⇒ Object
readonly
Returns the value of attribute note.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(eid, note = nil) ⇒ ErrorMessage
constructor
A new instance of ErrorMessage.
- #to_s ⇒ Object
-
#to_xml ⇒ Object
Return single error message as an xml element.
Constructor Details
#initialize(eid, note = nil) ⇒ ErrorMessage
Returns a new instance of ErrorMessage.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/raakt.rb', line 57 def initialize(eid, note=nil) @eid = eid if note @text = MESSAGES[@eid].sub(/%s/, note) else @text = MESSAGES[@eid] end @note = note end |
Instance Attribute Details
#eid ⇒ Object (readonly)
Returns the value of attribute eid.
55 56 57 |
# File 'lib/raakt.rb', line 55 def eid @eid end |
#note ⇒ Object (readonly)
Returns the value of attribute note.
55 56 57 |
# File 'lib/raakt.rb', line 55 def note @note end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
55 56 57 |
# File 'lib/raakt.rb', line 55 def text @text end |
Instance Method Details
#to_s ⇒ Object
68 69 70 |
# File 'lib/raakt.rb', line 68 def to_s "#{@eid}: #{@text}" end |
#to_xml ⇒ Object
Return single error message as an xml element.
73 74 75 |
# File 'lib/raakt.rb', line 73 def to_xml "<message id=\"#{@eid}\">#{@text}</message>" end |