Sha256: 145f3a097c3d04e06ec2317aeb5ad38a097790088434f6c194308b32bf845f1c

Contents?: true

Size: 576 Bytes

Versions: 20

Compression:

Stored size: 576 Bytes

Contents

# encoding: utf-8
module TestServer
  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

20 entries across 20 versions & 1 rubygems

Version Path
test_server-0.5.2 lib/test_server/template_repository.rb
test_server-0.5.1 lib/test_server/template_repository.rb
test_server-0.5.0 lib/test_server/template_repository.rb
test_server-0.4.1 lib/test_server/template_repository.rb
test_server-0.4.0 lib/test_server/template_repository.rb
test_server-0.3.7 lib/test_server/template_repository.rb
test_server-0.3.6 lib/test_server/template_repository.rb
test_server-0.3.5 lib/test_server/template_repository.rb
test_server-0.3.4 lib/test_server/template_repository.rb
test_server-0.3.2 lib/test_server/template_repository.rb
test_server-0.3.1 lib/test_server/template_repository.rb
test_server-0.2.4 lib/test_server/template_repository.rb
test_server-0.2.3 lib/test_server/template_repository.rb
test_server-0.2.2 lib/test_server/template_repository.rb
test_server-0.2.1 lib/test_server/template_repository.rb
test_server-0.2.0 lib/test_server/template_repository.rb
test_server-0.1.2 lib/test_server/template_repository.rb
test_server-0.1.1 lib/test_server/template_repository.rb
test_server-0.1.0 lib/test_server/template_repository.rb
test_server-0.0.11 lib/test_server/template_repository.rb