class Rabbit::Theme::Entry
Constants
- PROPERTY_BASE_NAME
- THEME_BASE_NAME
Attributes
Public Class Methods
Source
# File lib/rabbit/theme/entry.rb, line 39 def initialize(theme_dir, name) @theme_dir = theme_dir @name = name @title = @name @category = nil @abstract = nil @description = nil @dependencies = [] @parameters = {} parse_property if available? end
Public Instance Methods
Source
# File lib/rabbit/theme/entry.rb, line 59 def <=>(other) @name <=> other.name end
Source
# File lib/rabbit/theme/entry.rb, line 51 def available? File.readable?(theme_file) end
Source
# File lib/rabbit/theme/entry.rb, line 76 def category @category || N_("Etc") end
Source
# File lib/rabbit/theme/entry.rb, line 84 def data_dir File.join(@theme_dir, "data") end
Source
# File lib/rabbit/theme/entry.rb, line 88 def files if have_data_dir? Dir.glob(File.join(data_dir, "*")).sort else # backward compatibility rejected_files = [theme_file, property_file] Dir[File.join(@theme_dir, "*")].delete_if do |name| rejected_files.include?(name) end.sort end end
Source
# File lib/rabbit/theme/entry.rb, line 67 def full_path(target) if have_data_dir? File.join(data_dir, target) else # backward compatibility File.join(@theme_dir, target) end end
Source
# File lib/rabbit/theme/entry.rb, line 63 def have_file?(target) File.exist?(full_path(target)) end
Source
# File lib/rabbit/theme/entry.rb, line 80 def image_theme? have_data_dir? end
Source
# File lib/rabbit/theme/entry.rb, line 55 def property_editable? File.writable?(property_file) end
Private Instance Methods
Source
# File lib/rabbit/theme/entry.rb, line 117 def have_data_dir? File.directory?(data_dir) end
Source
# File lib/rabbit/theme/entry.rb, line 105 def parse_property file = property_file if File.exist?(file) content = File.open(file) {|f| f.read} begin instance_eval(content, file) rescue SyntaxError Rabbit.logger.warn($!) end end end
Source
# File lib/rabbit/theme/entry.rb, line 101 def property_file File.join(@theme_dir, "#{PROPERTY_BASE_NAME}.rb") end