Class: Dryad::Consul::ConfigObserver
- Inherits:
-
Dryad::Core::Observer
- Object
- Dryad::Core::Observer
- Dryad::Consul::ConfigObserver
- Defined in:
- lib/dryad/consul/config_observer.rb
Instance Method Summary collapse
-
#initialize ⇒ ConfigObserver
constructor
A new instance of ConfigObserver.
- #update(time, config_desc, exception) ⇒ Object
- #update_self(config_desc) ⇒ Object
- #version=(version) ⇒ Object
Constructor Details
#initialize ⇒ ConfigObserver
Returns a new instance of ConfigObserver.
4 5 6 |
# File 'lib/dryad/consul/config_observer.rb', line 4 def initialize @last_version = 0 end |
Instance Method Details
#update(time, config_desc, exception) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dryad/consul/config_observer.rb', line 12 def update(time, config_desc, exception) if exception puts "(#{time}) [#{self.class.to_s}] #{exception.}" elsif config_desc if @last_version < config_desc.version update_self(config_desc) @last_version = config_desc.version end end end |
#update_self(config_desc) ⇒ Object
23 24 25 |
# File 'lib/dryad/consul/config_observer.rb', line 23 def update_self(config_desc) raise "Implement this method" end |
#version=(version) ⇒ Object
8 9 10 |
# File 'lib/dryad/consul/config_observer.rb', line 8 def version=(version) @last_version = version end |