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



46
47
48
49
50
51
52
# File 'lib/construqt/templates.rb', line 46

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



40
41
42
43
44
# File 'lib/construqt/templates.rb', line 40

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