Class: FakeConsul::Server

Inherits:
HashWithIndifferentAccess
  • Object
show all
Defined in:
lib/fake_consul/server.rb

Instance Method Summary collapse

Instance Method Details

#get(key, options = nil, not_found = :reject, found = :return) ⇒ Array<Hash>

Fake get

Performs no http requests but stores data in local hash



14
15
16
17
18
19
20
21
22
# File 'lib/fake_consul/server.rb', line 14

def get(key, options = nil, not_found = :reject, found = :return)
  options ||= {}

  if options[:recurse]
    find_keys_recursive(key)
  else
    consul_export_format(key)
  end
end

#put(key, value, options = nil) ⇒ Boolean

Fake put

Performs no http requests but retrieves data from local hash



31
32
33
34
35
# File 'lib/fake_consul/server.rb', line 31

def put(key, value, options = nil)
  self[key] = value
  compact
  true
end