Module: Docks::NamingConventions

Defined in:
lib/docks/naming_conventions.rb,
lib/docks/naming_conventions/bem_naming_convention.rb,
lib/docks/naming_conventions/base_naming_convention.rb,
lib/docks/naming_conventions/suit_naming_convention.rb

Defined Under Namespace

Classes: BEM, Base, SUIT

Class Method Summary collapse

Class Method Details

.for(convention) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/docks/naming_conventions.rb', line 7

def self.for(convention)
  if [String, ::Symbol].include?(convention.class)
    convention = convention.to_sym
    begin
      convention = const_get(convention).instance
    rescue NameError
    end
  else
    convention = convention.instance if convention.kind_of?(Class)
  end

  convention.kind_of?(Base) ? convention : nil
end