Class LayoutTemplate
In: app/models/layout_template.rb
Parent: Object

Methods

all   description   find   new   number_of_boxes   read_config   title  

Attributes

id  [R] 

Public Class methods

[Source]

    # File app/models/layout_template.rb, line 9
 9:   def self.all
10:     Dir.glob(File.join(RAILS_ROOT, 'public', 'designs', 'templates', '*')).map {|item| find(File.basename(item)) }
11:   end

[Source]

   # File app/models/layout_template.rb, line 3
3:   def self.find(id)
4:     t = new(id)
5:     t.send(:read_config)
6:     t
7:   end

[Source]

    # File app/models/layout_template.rb, line 14
14:   def initialize(id)
15:     @id = id
16:   end

Public Instance methods

[Source]

    # File app/models/layout_template.rb, line 22
22:   def description
23:     @config['description']
24:   end

[Source]

    # File app/models/layout_template.rb, line 26
26:   def number_of_boxes
27:     @config['number_of_boxes']
28:   end

[Source]

    # File app/models/layout_template.rb, line 18
18:   def title
19:     @config['title']
20:   end

Protected Instance methods

[Source]

    # File app/models/layout_template.rb, line 32
32:   def read_config
33:     @config = YAML.load_file(File.join(RAILS_ROOT, 'public', 'designs', 'templates', id, 'config.yml'))
34:   end

[Validate]