Class: BooticCli::Themes::MemTheme
- Inherits:
-
Object
- Object
- BooticCli::Themes::MemTheme
show all
- Defined in:
- lib/bootic_cli/themes/mem_theme.rb
Defined Under Namespace
Classes: Template, ThemeAsset
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of MemTheme.
7
8
9
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 7
def initialize
reload!
end
|
Instance Attribute Details
#assets ⇒ Object
Implement generic Theme interface
12
13
14
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 12
def assets
@assets
end
|
#templates ⇒ Object
Implement generic Theme interface
12
13
14
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 12
def templates
@templates
end
|
Instance Method Details
#add_asset(file_name, file, mtime: Time.now) ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 42
def add_asset(file_name, file, mtime: Time.now)
asset = ThemeAsset.new(file_name, file, mtime)
if idx = assets.index { |t| t.file_name == file_name }
assets[idx] = asset
else
assets << asset
end
end
|
#add_template(file_name, body, mtime: Time.now) ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 27
def add_template(file_name, body, mtime: Time.now)
tpl = Template.new(file_name, body, mtime)
if idx = templates.index { |t| t.file_name == file_name }
templates[idx] = tpl
else
templates << tpl
end
end
|
#path ⇒ Object
18
19
20
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 18
def path
nil
end
|
#public? ⇒ Boolean
14
15
16
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 14
def public?
false end
|
#reload! ⇒ Object
22
23
24
25
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 22
def reload!
@templates = []
@assets = []
end
|
#remove_asset(file_name) ⇒ Object
51
52
53
54
55
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 51
def remove_asset(file_name)
if idx = assets.index { |t| t.file_name == file_name }
assets.delete_at idx
end
end
|
#remove_template(file_name) ⇒ Object
36
37
38
39
40
|
# File 'lib/bootic_cli/themes/mem_theme.rb', line 36
def remove_template(file_name)
if idx = templates.index { |t| t.file_name == file_name }
templates.delete_at idx
end
end
|