Class: Rabbit::Theme::Entry
- Inherits:
-
Object
- Object
- Rabbit::Theme::Entry
show all
- Extended by:
- ERB::DefMethod
- Includes:
- ERB::Util, Enumerable, GetText
- Defined in:
- lib/rabbit/theme/entry.rb
Constant Summary
collapse
- THEME_BASE_NAME =
"theme"
- PROPERTY_BASE_NAME =
"property"
Constants included
from GetText
GetText::DOMAIN
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from GetText
included
Constructor Details
permalink
#initialize(logger, theme_dir, name) ⇒ Entry
Returns a new instance of Entry.
[View source]
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/rabbit/theme/entry.rb', line 40
def initialize(logger, theme_dir, name)
@logger = logger
@theme_dir = theme_dir
@name = name
@title = @name
@category = nil
@abstract = nil
@description = nil
@dependencies = []
@parameters = {}
parse_property if available?
end
|
Instance Attribute Details
permalink
#abstract ⇒ Object
Returns the value of attribute abstract.
36
37
38
|
# File 'lib/rabbit/theme/entry.rb', line 36
def abstract
@abstract
end
|
permalink
#dependencies ⇒ Object
Returns the value of attribute dependencies.
37
38
39
|
# File 'lib/rabbit/theme/entry.rb', line 37
def dependencies
@dependencies
end
|
permalink
#description ⇒ Object
Returns the value of attribute description.
35
36
37
|
# File 'lib/rabbit/theme/entry.rb', line 35
def description
@description
end
|
Returns the value of attribute logger.
38
39
40
|
# File 'lib/rabbit/theme/entry.rb', line 38
def logger
@logger
end
|
Returns the value of attribute name.
35
36
37
|
# File 'lib/rabbit/theme/entry.rb', line 35
def name
@name
end
|
permalink
#parameters ⇒ Object
Returns the value of attribute parameters.
37
38
39
|
# File 'lib/rabbit/theme/entry.rb', line 37
def parameters
@parameters
end
|
Returns the value of attribute title.
35
36
37
|
# File 'lib/rabbit/theme/entry.rb', line 35
def title
@title
end
|
Instance Method Details
permalink
#<=>(other) ⇒ Object
[View source]
61
62
63
|
# File 'lib/rabbit/theme/entry.rb', line 61
def <=>(other)
@name <=> other.name
end
|
permalink
#available? ⇒ Boolean
[View source]
53
54
55
|
# File 'lib/rabbit/theme/entry.rb', line 53
def available?
File.readable?(theme_file)
end
|
permalink
#category ⇒ Object
[View source]
78
79
80
|
# File 'lib/rabbit/theme/entry.rb', line 78
def category
@category || N_("Etc")
end
|
permalink
#data_dir ⇒ Object
[View source]
86
87
88
|
# File 'lib/rabbit/theme/entry.rb', line 86
def data_dir
File.join(@theme_dir, "data")
end
|
[View source]
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/rabbit/theme/entry.rb', line 90
def files
if have_data_dir?
Dir.glob(File.join(data_dir, "*")).sort
else
rejected_files = [theme_file, property_file]
Dir[File.join(@theme_dir, "*")].delete_if do |name|
rejected_files.include?(name)
end.sort
end
end
|
permalink
#full_path(target) ⇒ Object
[View source]
69
70
71
72
73
74
75
76
|
# File 'lib/rabbit/theme/entry.rb', line 69
def full_path(target)
if have_data_dir?
File.join(data_dir, target)
else
File.join(@theme_dir, target)
end
end
|
permalink
#have_file?(target) ⇒ Boolean
[View source]
65
66
67
|
# File 'lib/rabbit/theme/entry.rb', line 65
def have_file?(target)
File.exist?(full_path(target))
end
|
permalink
#image_theme? ⇒ Boolean
[View source]
82
83
84
|
# File 'lib/rabbit/theme/entry.rb', line 82
def image_theme?
have_data_dir?
end
|
permalink
#property_editable? ⇒ Boolean
[View source]
57
58
59
|
# File 'lib/rabbit/theme/entry.rb', line 57
def property_editable?
File.writable?(property_file)
end
|