Class: ElasticNotifier::Signal
- Inherits:
-
Object
- Object
- ElasticNotifier::Signal
- Defined in:
- lib/elastic_notifier/signal.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(overrides = {}) ⇒ Signal
constructor
A new instance of Signal.
- #severity ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(overrides = {}) ⇒ Signal
Returns a new instance of Signal.
5 6 7 8 9 10 11 12 |
# File 'lib/elastic_notifier/signal.rb', line 5 def initialize(overrides = {}) @pid = Process.pid @hostname = Socket.gethostname @ip = find_ip_address = Time.now.strftime('%Y-%m-%dT%H:%M:%S') @program_name = $PROGRAM_NAME @overrides = overrides end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/elastic_notifier/signal.rb', line 3 def attributes @attributes end |
Instance Method Details
#data ⇒ Object
30 31 32 |
# File 'lib/elastic_notifier/signal.rb', line 30 def data raise NotImplementedError end |
#severity ⇒ Object
26 27 28 |
# File 'lib/elastic_notifier/signal.rb', line 26 def severity raise NotImplementedError end |
#to_hash ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/elastic_notifier/signal.rb', line 14 def to_hash { severity: severity, timestamp: , program_name: @program_name, pid: @pid, hostname: @hostname, ip: @ip, data: data }.merge(@overrides) end |