class BooticCli::Themes::MemTheme

Constants

Template
ThemeAsset

Attributes

assets[R]

Implement generic Theme interface

templates[R]

Implement generic Theme interface

Public Class Methods

new() click to toggle source
# File lib/bootic_cli/themes/mem_theme.rb, line 7
def initialize
  reload!
end

Public Instance Methods

add_asset(file_name, file, mtime: Time.now) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/bootic_cli/themes/mem_theme.rb, line 18
def path
  nil
end
public?() click to toggle source
# File lib/bootic_cli/themes/mem_theme.rb, line 14
def public?
  false # just for tests
end
reload!() click to toggle source
# File lib/bootic_cli/themes/mem_theme.rb, line 22
def reload!
  @templates = []
  @assets = []
end
remove_asset(file_name) click to toggle source
# 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) click to toggle source
# 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