Class: SettingsReader::VaultResolver::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/settings_reader/vault_resolver/address.rb

Overview

Parsing of vault address

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Address

Returns a new instance of Address.



5
6
7
# File 'lib/settings_reader/vault_resolver/address.rb', line 5

def initialize(uri)
  @uri = URI.parse(uri)
end

Instance Method Details

#attributeObject



21
22
23
# File 'lib/settings_reader/vault_resolver/address.rb', line 21

def attribute
  @uri.fragment
end

#full_pathObject



17
18
19
# File 'lib/settings_reader/vault_resolver/address.rb', line 17

def full_path
  "#{mount}#{@uri.path}"
end

#mountObject



9
10
11
# File 'lib/settings_reader/vault_resolver/address.rb', line 9

def mount
  @uri.host
end

#no_cache?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/settings_reader/vault_resolver/address.rb', line 29

def no_cache?
  options['no_cache'] == 'true'
end

#optionsObject



25
26
27
# File 'lib/settings_reader/vault_resolver/address.rb', line 25

def options
  URI.decode_www_form(@uri.query || '').to_h
end

#pathObject



13
14
15
# File 'lib/settings_reader/vault_resolver/address.rb', line 13

def path
  @uri.path.delete_prefix('/')
end

#to_sObject



33
34
35
# File 'lib/settings_reader/vault_resolver/address.rb', line 33

def to_s
  @uri.to_s
end