Class: Connect::Datasources::ConsulBase
- Inherits:
-
Base
- Object
- Base
- Connect::Datasources::ConsulBase
- Defined in:
- lib/connect/datasources/consul_base.rb
Overview
The base class for Consul data sources
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(name, url = 'http://localhost:8500') ⇒ ConsulBase
constructor
A new instance of ConsulBase.
- #to_connect(value) ⇒ Object
Constructor Details
#initialize(name, url = 'http://localhost:8500') ⇒ ConsulBase
Returns a new instance of ConsulBase.
18 19 20 21 22 23 24 25 |
# File 'lib/connect/datasources/consul_base.rb', line 18 def initialize( name, url = 'http://localhost:8500') unless defined?(Diplomat) fail "Fetching data from consul requires the diplomat gem" end ::Diplomat.configure do |config| config.url = url end end |
Instance Method Details
#to_connect(value) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/connect/datasources/consul_base.rb', line 28 def to_connect(value) if value.nil? nil else value = ::MethodHash[value.marshal_dump] value.extend(HashExtensions) value.stringify_keys end end |