Class: TailwindTheme::Factory
- Inherits:
-
Object
- Object
- TailwindTheme::Factory
- Defined in:
- lib/tailwind_theme/factory.rb
Overview
Theme factory to load and cache a theme.
Instance Method Summary collapse
-
#initialize ⇒ Factory
constructor
A new instance of Factory.
-
#theme(name = nil) ⇒ TailwindTheme::Theme, NilClass
Load and cache the theme.
Constructor Details
#initialize ⇒ Factory
Returns a new instance of Factory.
15 16 17 |
# File 'lib/tailwind_theme/factory.rb', line 15 def initialize @themes = {} end |
Instance Method Details
#theme(name = nil) ⇒ TailwindTheme::Theme, NilClass
Load and cache the theme.
The default theme load order:
1) themes/default.yml(.erb)
2) theme.yml(.erb)
28 29 30 31 32 33 34 |
# File 'lib/tailwind_theme/factory.rb', line 28 def theme(name = nil) if name.nil? || name.to_s == "default" @themes[:default] ||= load_default_theme else @themes[name.to_sym] = load_by_name name.to_sym end end |