Class: Consul::Async::ConsulTemplateNode

Inherits:
ConsulTemplateAbstractMap show all
Defined in:
lib/consul/async/consul_template.rb

Overview

Get information about a single node

Instance Attribute Summary

Attributes inherited from ConsulTemplateAbstract

#endpoint, #result, #seen_at

Instance Method Summary collapse

Methods inherited from ConsulTemplateAbstract

#_seen_at, #initialize, #method_missing, #ready?, #respond_to_missing?

Constructor Details

This class inherits a constructor from Consul::Async::ConsulTemplateAbstract

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Consul::Async::ConsulTemplateAbstract

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


619
620
621
# File 'lib/consul/async/consul_template.rb', line 619

def exists?
  !result_delegate.nil?
end

#nodeObject



634
635
636
# File 'lib/consul/async/consul_template.rb', line 634

def node
  safe_get['Node'] || {}
end

#safe_getObject



623
624
625
626
627
628
629
630
631
632
# File 'lib/consul/async/consul_template.rb', line 623

def safe_get
  if exists?
    result_delegate
  else
    {
      'Node': {},
      'Services': {}
    }
  end
end

#servicesObject



638
639
640
# File 'lib/consul/async/consul_template.rb', line 638

def services
  safe_get['Services'] || {}
end