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.



650
651
652
653
# File 'lib/consul/async/consul_template.rb', line 650

def initialize(obj)
  super
  merge!(obj)
end

Instance Method Details

#serf_statusesObject

List the possible Serf statuses as text, indexed by self



656
657
658
# File 'lib/consul/async/consul_template.rb', line 656

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

#statusObject

Return status as text



661
662
663
# File 'lib/consul/async/consul_template.rb', line 661

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