Class: Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/theme_support/theme.rb

Constant Summary collapse

@@cache_theme_lookup =
false

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Theme

Returns a new instance of Theme.



7
8
9
10
11
# File 'lib/theme_support/theme.rb', line 7

def initialize(name)
  @name = name
  @title = name.underscore.humanize.titleize
  @description_html = nil
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/theme_support/theme.rb', line 5

def description
  @description
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/theme_support/theme.rb', line 5

def name
  @name
end

#preview_imageObject

Returns the value of attribute preview_image.



5
6
7
# File 'lib/theme_support/theme.rb', line 5

def preview_image
  @preview_image
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/theme_support/theme.rb', line 5

def title
  @title
end

Class Method Details

.find_allObject



28
29
30
31
32
# File 'lib/theme_support/theme.rb', line 28

def self.find_all
  installed_themes.inject([]) do |array, path|
    array << theme_from_path(path)
  end
end

Instance Method Details

#has_preview?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/theme_support/theme.rb', line 20

def has_preview?
  File.exists?( File.join( Theme.path_to_theme(name), 'images', 'preview.png' ) ) rescue false
end