Class: Hieracles::Notification
- Inherits:
-
Object
- Object
- Hieracles::Notification
- Defined in:
- lib/hieracles/notification.rb
Constant Summary collapse
- LEVEL =
{ 'fatal' => 0, 'error' => 1, 'warning' => 2, 'info' => 3, 'debug' => 4 }
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(source, message, level = 'info') ⇒ Notification
constructor
A new instance of Notification.
- #to_hash ⇒ Object
Constructor Details
#initialize(source, message, level = 'info') ⇒ Notification
Returns a new instance of Notification.
13 14 15 16 17 18 |
# File 'lib/hieracles/notification.rb', line 13 def initialize(source, , level = 'info') @source = source @level = level @message = @timestamp = Time.new end |
Instance Attribute Details
#level ⇒ Object (readonly)
Returns the value of attribute level.
3 4 5 |
# File 'lib/hieracles/notification.rb', line 3 def level @level end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/hieracles/notification.rb', line 3 def @message end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/hieracles/notification.rb', line 3 def source @source end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
3 4 5 |
# File 'lib/hieracles/notification.rb', line 3 def @timestamp end |
Instance Method Details
#to_hash ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/hieracles/notification.rb', line 20 def to_hash { 'source' => @source, 'level' => @level, 'message' => @message, 'timestamp' => @timestamp } end |