Class: Pageflow::Themes

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/pageflow/themes.rb

Instance Method Summary collapse

Constructor Details

#initializeThemes

Returns a new instance of Themes.



5
6
7
# File 'lib/pageflow/themes.rb', line 5

def initialize
  @themes = HashWithIndifferentAccess.new
end

Instance Method Details

#each(&block) ⇒ Object



21
22
23
# File 'lib/pageflow/themes.rb', line 21

def each(&block)
  @themes.values.each(&block)
end

#get(name) ⇒ Object



13
14
15
# File 'lib/pageflow/themes.rb', line 13

def get(name)
  @themes.fetch(name) { raise(ArgumentError, "Unknown theme '#{name}'.") }
end

#namesObject



17
18
19
# File 'lib/pageflow/themes.rb', line 17

def names
  map(&:name)
end

#register(name, options = {}) ⇒ Object



9
10
11
# File 'lib/pageflow/themes.rb', line 9

def register(name, options = {})
  @themes[name] = Theme.new(name, options)
end