Class: Consul::Async::SerfMember

Inherits:
Hash
  • Object
show all
Defined in:
lib/consul/async/consul_template.rb

Overview

The ServiceInstance has shortcuts (such as service_address method), but is basically a Hash.

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ SerfMember

Returns a new instance of SerfMember.



672
673
674
# File 'lib/consul/async/consul_template.rb', line 672

def initialize(obj)
  merge!(obj)
end

Instance Method Details

#serf_statusesObject

List the possible Serf statuses as text, indexed by self



677
678
679
# File 'lib/consul/async/consul_template.rb', line 677

def serf_statuses
  %w[none alive leaving left failed].freeze
end

#statusObject

Return status as text



682
683
684
# File 'lib/consul/async/consul_template.rb', line 682

def status
  serf_statuses[self['Status']] || "unknownStatus:#{self['Status']}"
end