Module: WhirledPeas::Settings::ThemeLibrary

Defined in:
lib/whirled_peas/settings/theme_library.rb

Constant Summary collapse

CONFIG_FILE =
File.join(File.dirname(File.dirname(File.dirname(__FILE__))), 'data', 'themes.yaml')

Class Method Summary collapse

Class Method Details

.add(name, theme) ⇒ Object



15
16
17
# File 'lib/whirled_peas/settings/theme_library.rb', line 15

def add(name, theme)
  themes[name] = theme
end

.default_nameObject



27
28
29
# File 'lib/whirled_peas/settings/theme_library.rb', line 27

def default_name
  themes.keys.first
end

.get(name) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/whirled_peas/settings/theme_library.rb', line 19

def get(name)
  unless themes.key?(name)
    expected = themes.keys.map(&:inspect).join(', ')
    raise ArgumentError, "Unknown theme: #{name.inspect}, expecting one of #{expected}"
  end
  themes[name]
end

.theme_namesObject



11
12
13
# File 'lib/whirled_peas/settings/theme_library.rb', line 11

def theme_names
  themes.keys
end