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.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/raakt.rb', line 58 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.
56 57 58 |
# File 'lib/raakt.rb', line 56 def eid @eid end |
#note ⇒ Object (readonly)
Returns the value of attribute note.
56 57 58 |
# File 'lib/raakt.rb', line 56 def note @note end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
56 57 58 |
# File 'lib/raakt.rb', line 56 def text @text end |
Instance Method Details
#to_s ⇒ Object
69 70 71 |
# File 'lib/raakt.rb', line 69 def to_s "#{@eid}: #{@text}" end |
#to_xml ⇒ Object
Return single error message as an xml element.
74 75 76 |
# File 'lib/raakt.rb', line 74 def to_xml "<message id=\"#{@eid}\">#{@text}</message>" end |