Class: Consul::Async::ConsulTemplateAbstract

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

Overview

Abstract class that stores information about a result

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#endpointObject (readonly)

Returns the value of attribute endpoint.



439
440
441
# File 'lib/consul/async/consul_template.rb', line 439

def endpoint
  @endpoint
end

#resultObject (readonly)

Returns the value of attribute result.



439
440
441
# File 'lib/consul/async/consul_template.rb', line 439

def result
  @result
end

#seen_atObject (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

Returns:

  • (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

Returns:

  • (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