Sha256: 00ec63bd4e8d425a7e534e2cd491b1cabf35a33d1189d6bec47583a981d0ae82

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

module Veewee

    class Providers
      def initialize(env)
        @env=env
        @providers=Hash.new
      end

      def [](name)
             return @providers[name] if @providers.has_key?(name)

             begin
               require_path='veewee/provider/'+name.to_s.downcase+"/provider"
               require require_path

               provider=Object.const_get("Veewee").const_get("Provider").const_get(name.to_s.capitalize).const_get("Provider").new(name,{},@env)

               @providers[name]=provider
             rescue ::Veewee::Error => e
                raise
             rescue Error => e
               env.ui.error "Error loading provider with #{name},#{$!}"
             end
      end

      def length
        @providers.length
      end

  end
end #Module Veewee

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veewee-0.3.0.alpha6 lib/veewee/providers.rb
veewee-0.3.0.alpha5 lib/veewee/providers.rb