Method: Landable::Layout#to_theme

Defined in:
lib/landable/layout.rb

#to_themeObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/landable/layout.rb', line 26

def to_theme
  process unless @processed

  theme = Theme.where(file: @path).first_or_initialize
  theme.name ||= @path.gsub('/', ' ').titlecase
  theme.extension       = @extension
  theme.description     = description if theme.description.blank? || theme.description =~ /^Defined in/
  theme.body            = @body
  theme.editable        = false
  theme.thumbnail_url ||= 'http://placehold.it/300x200'

  theme.save!

  theme
end