Class: Consul::Async::ConsulTemplateNode
- Inherits:
-
ConsulTemplateAbstractMap
- Object
- ConsulTemplateAbstract
- ConsulTemplateAbstractMap
- Consul::Async::ConsulTemplateNode
- Defined in:
- lib/consul/async/consul_template.rb
Overview
Get information about a single node
Instance Attribute Summary
Attributes inherited from ConsulTemplateAbstract
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(consul_endpoint) ⇒ ConsulTemplateNode
constructor
A new instance of ConsulTemplateNode.
- #node ⇒ Object
- #safe_get ⇒ Object
- #services ⇒ Object
Methods inherited from ConsulTemplateAbstract
#_seen_at, #method_missing, #ready?, #respond_to_missing?
Constructor Details
#initialize(consul_endpoint) ⇒ ConsulTemplateNode
Returns a new instance of ConsulTemplateNode.
634 635 636 |
# File 'lib/consul/async/consul_template.rb', line 634 def initialize(consul_endpoint) super(consul_endpoint) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Consul::Async::ConsulTemplateAbstract
Instance Method Details
#exists? ⇒ Boolean
638 639 640 |
# File 'lib/consul/async/consul_template.rb', line 638 def exists? !result_delegate.nil? end |
#node ⇒ Object
653 654 655 |
# File 'lib/consul/async/consul_template.rb', line 653 def node safe_get['Node'] || {} end |
#safe_get ⇒ Object
642 643 644 645 646 647 648 649 650 651 |
# File 'lib/consul/async/consul_template.rb', line 642 def safe_get if exists? result_delegate else { 'Node': {}, 'Services': {} } end end |
#services ⇒ Object
657 658 659 |
# File 'lib/consul/async/consul_template.rb', line 657 def services safe_get['Services'] || {} end |