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.



446
447
448
449
450
451
452
# File 'lib/consul/async/consul_template.rb', line 446

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



462
463
464
465
466
467
468
# File 'lib/consul/async/consul_template.rb', line 462

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.



444
445
446
# File 'lib/consul/async/consul_template.rb', line 444

def endpoint
  @endpoint
end

#resultObject (readonly)

Returns the value of attribute result.



444
445
446
# File 'lib/consul/async/consul_template.rb', line 444

def result
  @result
end

#seen_atObject (readonly)

Returns the value of attribute seen_at.



444
445
446
# File 'lib/consul/async/consul_template.rb', line 444

def seen_at
  @seen_at
end

Instance Method Details

#_seen_at(val) ⇒ Object



454
455
456
# File 'lib/consul/async/consul_template.rb', line 454

def _seen_at(val)
  @seen_at = val
end

#ready?Boolean

Returns:

  • (Boolean)


458
459
460
# File 'lib/consul/async/consul_template.rb', line 458

def ready?
  @endpoint.ready?
end

#respond_to_missing?(method_name, *args) ⇒ Boolean

Returns:

  • (Boolean)


470
471
472
# File 'lib/consul/async/consul_template.rb', line 470

def respond_to_missing?(method_name, *args)
  result_delegate.respond_to?(method_name, *args)
end