Sha256: 909e0fa2817e2287f7b3dea874f8459811d50744ff22060997c7350151601aaa

Contents?: true

Size: 577 Bytes

Versions: 18

Compression:

Stored size: 577 Bytes

Contents

# encoding: utf-8
module ProxyTester
  class TemplateRepository
    private

    attr_reader :root_directory, :creator

    public

    def initialize(root_directory = ::File.expand_path('../../../files', __FILE__), creator = TemplateFile)
      @root_directory = ::File.expand_path(root_directory)
      @creator        = creator
    end

    def find(name)
      path = ::File.join(root_directory, "#{name.to_s}.erb")
      fail Exceptions::ErbTemplateIsUnknown, "Template \"#{name}\" could not be found!" unless ::File.exist? path

      creator.new(path)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
proxy_tester-0.1.10 lib/proxy_tester/template_repository.rb
proxy_tester-0.1.8 lib/proxy_tester/template_repository.rb
proxy_tester-0.1.6 lib/proxy_tester/template_repository.rb
proxy_tester-0.1.5 lib/proxy_tester/template_repository.rb
proxy_tester-0.1.4 lib/proxy_tester/template_repository.rb
proxy_tester-0.1.3 lib/proxy_tester/template_repository.rb
proxy_tester-0.1.2 lib/proxy_tester/template_repository.rb
proxy_tester-0.1.1 lib/proxy_tester/template_repository.rb
proxy_tester-0.1.0 lib/proxy_tester/template_repository.rb
proxy_tester-0.0.9 lib/proxy_tester/template_repository.rb
proxy_tester-0.0.8 lib/proxy_tester/template_repository.rb
proxy_tester-0.0.7 lib/proxy_tester/template_repository.rb
proxy_tester-0.0.6 lib/proxy_tester/template_repository.rb
proxy_tester-0.0.5 lib/proxy_tester/template_repository.rb
proxy_tester-0.0.4 lib/proxy_tester/template_repository.rb
proxy_tester-0.0.3 lib/proxy_tester/template_repository.rb
proxy_tester-0.0.2 lib/proxy_tester/template_repository.rb
proxy_tester-0.0.1 lib/proxy_tester/template_repository.rb