Class: Healthy::ServerIdentity
- Inherits:
-
Object
- Object
- Healthy::ServerIdentity
- Defined in:
- lib/healthy/server_identity.rb
Class Attribute Summary collapse
-
.identity ⇒ Object
Returns the value of attribute identity.
Class Method Summary collapse
- .establish(string_or_method_name = nil, &block) ⇒ Object
- .fqdn ⇒ Object
-
.ip_and_port ⇒ Object
TODO.
- .matches?(test) ⇒ Boolean
Class Attribute Details
.identity ⇒ Object
Returns the value of attribute identity.
5 6 7 |
# File 'lib/healthy/server_identity.rb', line 5 def identity @identity end |
Class Method Details
.establish(string_or_method_name = nil, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/healthy/server_identity.rb', line 6 def establish(string_or_method_name = nil, &block) self.identity = if block yield elsif string_or_method_name.is_a? Symbol self.send(string_or_method_name) else string_or_method_name end if identity.nil? || identity.empty? raise ArgumentError, "server identity cannot be nil or empty" end end |
.fqdn ⇒ Object
23 24 25 26 27 |
# File 'lib/healthy/server_identity.rb', line 23 def fqdn fqdn = `hostname --fqdn`.strip fqdn = `hostname`.strip if fqdn == '' fqdn end |
.ip_and_port ⇒ Object
TODO
30 31 |
# File 'lib/healthy/server_identity.rb', line 30 def ip_and_port end |
.matches?(test) ⇒ Boolean
19 20 21 |
# File 'lib/healthy/server_identity.rb', line 19 def matches?(test) test.nil? || test.empty? || test == identity || test.is_a?(Array) && test.include?(identity) end |