Module: Docks::Themes

Defined in:
lib/docks/themes.rb

Class Method Summary collapse

Class Method Details

.for(theme) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/docks/themes.rb', line 3

def self.for(theme)
  if [String, ::Symbol].include?(theme.class)
    begin
      require "docks_theme_#{theme.to_s.downcase}"
      theme = theme.to_sym
      theme = const_get(theme).instance
    rescue LoadError, NameError
      theme = false
    end
  else
    theme = theme.instance if theme.kind_of?(Class)
  end

  theme
end