Class: Consul::Data

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/consul/data.rb

Instance Method Summary collapse

Constructor Details

#initialize(response_hash) ⇒ Data

Returns a new instance of Data.



10
11
12
# File 'lib/consul/data.rb', line 10

def initialize(response_hash)
  @response = response_hash
end

Instance Method Details

#flagsObject



23
24
25
# File 'lib/consul/data.rb', line 23

def flags
  hash_map(__callee__)
end

#valueObject



14
15
16
17
18
19
20
21
# File 'lib/consul/data.rb', line 14

def value
  text = Base64.decode64(hash_map('Value'))
  begin
    decoded = Consul::Client.decode(text)
  rescue Psych::DisallowedClass, Psych::SyntaxError
  end
  decoded || text
end