Module: Txgh::Config::ProviderSupport
- Included in:
- KeyManager, TxManager
- Defined in:
- lib/txgh/config/provider_support.rb
Instance Method Summary collapse
- #provider_for(scheme) ⇒ Object
- #providers ⇒ Object
- #register_provider(provider, parser, options = {}) ⇒ Object
- #split_uri(uri) ⇒ Object
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 |
#providers ⇒ Object
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, = {}) providers << ProviderInstance.new(provider, parser, ) 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 |