Module: Txgh::Config::ProviderSupport

Included in:
KeyManager, TxManager
Defined in:
lib/txgh/config/provider_support.rb

Instance Method Summary collapse

Instance Method Details

#provider_for(scheme) ⇒ Object



12
13
14
15
# File 'lib/txgh/config/provider_support.rb', line 12

def provider_for(scheme)
  provider = providers.find { |provider| provider.supports?(scheme) }
  provider || providers.find(&:default?)
end

#providersObject



8
9
10
# File 'lib/txgh/config/provider_support.rb', line 8

def providers
  @providers ||= []
end

#register_provider(provider, parser, options = {}) ⇒ Object



4
5
6
# File 'lib/txgh/config/provider_support.rb', line 4

def register_provider(provider, parser, options = {})
  providers << ProviderInstance.new(provider, parser, options)
end

#split_uri(uri) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/txgh/config/provider_support.rb', line 17

def split_uri(uri)
  if uri =~ /\A[\w]+:\/\//
    idx = uri.index('://')
    [uri[0...idx], uri[(idx + 3)..-1]]
  else
    [nil, uri]
  end
end