Class: Watcher::Hostname
- Inherits:
-
BasicWatcher
- Object
- BasicWatcher
- Watcher::Hostname
- Defined in:
- lib/informer/watcher/hostname.rb
Instance Attribute Summary collapse
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
Instance Method Summary collapse
-
#initialize(interface = "eth0", &block) ⇒ Hostname
constructor
A new instance of Hostname.
- #message ⇒ Object
- #report ⇒ Object
Constructor Details
#initialize(interface = "eth0", &block) ⇒ Hostname
Returns a new instance of Hostname.
6 7 8 9 |
# File 'lib/informer/watcher/hostname.rb', line 6 def initialize(interface = "eth0", &block) @custom_message = block if block_given? @interface = interface end |
Instance Attribute Details
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
4 5 6 |
# File 'lib/informer/watcher/hostname.rb', line 4 def hostname @hostname end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
4 5 6 |
# File 'lib/informer/watcher/hostname.rb', line 4 def ip @ip end |
Instance Method Details
#message ⇒ Object
16 17 18 |
# File 'lib/informer/watcher/hostname.rb', line 16 def @message ||= "#{hostname}\n#{ip}" end |
#report ⇒ Object
11 12 13 14 |
# File 'lib/informer/watcher/hostname.rb', line 11 def report return @custom_message.call(self) if @custom_message end |