Class: ProviderFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/open-dock/providers.rb

Class Method Summary collapse

Class Method Details

.build(provider_name) ⇒ Object



34
35
36
# File 'lib/open-dock/providers.rb', line 34

def build(provider_name)
  provider_name.classify.constantize.new
end

.list_providersObject



38
39
40
41
42
43
# File 'lib/open-dock/providers.rb', line 38

def list_providers
  say Dir.glob("#{File.dirname(__FILE__)}/providers/*.rb").
      select{|f| f.include? ".rb"}.
      map{|f| f.split("/").last.split(".")[0]}.
      join ", "
end