Class: Gorynich::Fetchers::Consul
- Inherits:
-
Object
- Object
- Gorynich::Fetchers::Consul
- Defined in:
- lib/gorynich/fetchers/consul.rb
Instance Attribute Summary collapse
-
#consul_opts ⇒ Object
readonly
Returns the value of attribute consul_opts.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(storage:, **opts) ⇒ Consul
constructor
A new instance of Consul.
Constructor Details
#initialize(storage:, **opts) ⇒ Consul
Returns a new instance of Consul.
8 9 10 11 |
# File 'lib/gorynich/fetchers/consul.rb', line 8 def initialize(storage:, **opts) @storage = storage @consul_opts = opts end |
Instance Attribute Details
#consul_opts ⇒ Object (readonly)
Returns the value of attribute consul_opts.
6 7 8 |
# File 'lib/gorynich/fetchers/consul.rb', line 6 def consul_opts @consul_opts end |
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
6 7 8 |
# File 'lib/gorynich/fetchers/consul.rb', line 6 def storage @storage end |
Instance Method Details
#fetch ⇒ Object
13 14 15 16 |
# File 'lib/gorynich/fetchers/consul.rb', line 13 def fetch config = ::Diplomat::Kv.get_all(storage, convert_to_hash: true, **consul_opts) config.dig(*storage.split('/')) || {} end |