Class: Construqt::Templates

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

Defined Under Namespace

Classes: Template

Instance Method Summary collapse

Constructor Details

#initialize(region) ⇒ Templates

Returns a new instance of Templates.



4
5
6
7
# File 'lib/construqt/templates.rb', line 4

def initialize(region)
  @region = region
  @templates = {}
end

Instance Method Details

#add(name, cfg) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/construqt/templates.rb', line 29

def add(name, cfg)
  throw "template with name #{name} exists" if @templates[name]
  cfg['name'] = name
  ret = Template.new(cfg)
  @templates[name] = ret
  ret
end

#find(name) ⇒ Object



23
24
25
26
27
# File 'lib/construqt/templates.rb', line 23

def find(name)
  ret = @templates[name]
  throw "template with name #{name} not found" unless @templates[name]
  ret
end