Sha256: 7a93217f0b59c32457fd557fb684413323738e3148cabbcd73e72b50a2e51243

Contents?: true

Size: 550 Bytes

Versions: 11

Compression:

Stored size: 550 Bytes

Contents

# encoding: utf-8
module LocalPac
  class TemplateRepository
    private

    attr_reader :root_directory, :creator

    public

    def initialize(root_directory = File.expand_path('../../../files', __FILE__), creator = TemplateFile)
      @root_directory = 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

11 entries across 11 versions & 1 rubygems

Version Path
local_pac-0.1.10 lib/local_pac/template_repository.rb
local_pac-0.1.9 lib/local_pac/template_repository.rb
local_pac-0.1.8 lib/local_pac/template_repository.rb
local_pac-0.1.7 lib/local_pac/template_repository.rb
local_pac-0.1.6 lib/local_pac/template_repository.rb
local_pac-0.1.5 lib/local_pac/template_repository.rb
local_pac-0.1.4 lib/local_pac/template_repository.rb
local_pac-0.1.3 lib/local_pac/template_repository.rb
local_pac-0.1.2 lib/local_pac/template_repository.rb
local_pac-0.1.1 lib/local_pac/template_repository.rb
local_pac-0.1.0 lib/local_pac/template_repository.rb