Class: Consul::Async::ConsulTemplateAbstract
- Inherits:
-
Object
- Object
- Consul::Async::ConsulTemplateAbstract
- Defined in:
- lib/consul/async/consul_template.rb
Overview
Abstract class that stores information about a result
Direct Known Subclasses
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#seen_at ⇒ Object
readonly
Returns the value of attribute seen_at.
Instance Method Summary collapse
- #_seen_at(val) ⇒ Object
-
#initialize(consul_endpoint) ⇒ ConsulTemplateAbstract
constructor
A new instance of ConsulTemplateAbstract.
- #method_missing(method_name, *args, &block) ⇒ Object
- #ready? ⇒ Boolean
- #respond_to_missing?(method_name, *args) ⇒ Boolean
Constructor Details
#initialize(consul_endpoint) ⇒ ConsulTemplateAbstract
Returns a new instance of ConsulTemplateAbstract.
440 441 442 443 444 445 446 |
# File 'lib/consul/async/consul_template.rb', line 440 def initialize(consul_endpoint) @endpoint = consul_endpoint consul_endpoint.on_response do |res| @result = parse_result(res) end @result = parse_result(consul_endpoint.last_result) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
456 457 458 459 460 461 462 |
# File 'lib/consul/async/consul_template.rb', line 456 def method_missing(method_name, *args, &block) if result_delegate.respond_to?(method_name) result_delegate.send(method_name, *args, &block) else super end end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
439 440 441 |
# File 'lib/consul/async/consul_template.rb', line 439 def endpoint @endpoint end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
439 440 441 |
# File 'lib/consul/async/consul_template.rb', line 439 def result @result end |
#seen_at ⇒ Object (readonly)
Returns the value of attribute seen_at.
439 440 441 |
# File 'lib/consul/async/consul_template.rb', line 439 def seen_at @seen_at end |
Instance Method Details
#_seen_at(val) ⇒ Object
448 449 450 |
# File 'lib/consul/async/consul_template.rb', line 448 def _seen_at(val) @seen_at = val end |
#ready? ⇒ Boolean
452 453 454 |
# File 'lib/consul/async/consul_template.rb', line 452 def ready? @endpoint.ready? end |
#respond_to_missing?(method_name, *args) ⇒ Boolean
464 465 466 |
# File 'lib/consul/async/consul_template.rb', line 464 def respond_to_missing?(method_name, *args) result_delegate.respond_to?(method_name, *args) end |