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) ⇒ Object
- #split_uri(uri) ⇒ Object
Instance Method Details
#provider_for(scheme) ⇒ Object
12 13 14 |
# File 'lib/txgh/config/provider_support.rb', line 12 def provider_for(scheme) providers.find { |provider| provider.supports?(scheme) } end |
#providers ⇒ Object
8 9 10 |
# File 'lib/txgh/config/provider_support.rb', line 8 def providers @providers ||= [] end |
#register_provider(provider, parser) ⇒ 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
16 17 18 19 20 21 22 23 |
# File 'lib/txgh/config/provider_support.rb', line 16 def split_uri(uri) if uri =~ /\A[\w]+:\/\// idx = uri.index('://') [uri[0...idx], uri[(idx + 3)..-1]] else [nil, uri] end end |