Class: Egg::Templates

Inherits:
Object
  • Object
show all
Defined in:
lib/egg/templates.rb

Overview

Aids in the loading of template files bundled in the gem.

Defined Under Namespace

Classes: TemplateNotFoundError

Class Method Summary collapse

Class Method Details

.[](filename) ⇒ Object



10
11
12
13
14
# File 'lib/egg/templates.rb', line 10

def self.[](filename)
  template_path = Egg.root_join("..", "templates", filename)
  raise(TemplateNotFoundError, "No #{filename}") unless File.exist?(template_path)
  ERB.new(File.read(template_path))
end