Module: Lookbook::Lang

Defined in:
lib/lookbook/lang.rb

Constant Summary collapse

CONFIG_FILE =
"config/languages.yml"
LANGUAGES =

retained for backwards compatability

[]

Class Method Summary collapse

Class Method Details

.find(name) ⇒ Object



7
8
9
# File 'lib/lookbook/lang.rb', line 7

def find(name)
  languages.find { |l| l[:name] == name.to_s }
end

.guess(path, fallback_name = nil) ⇒ Object



11
12
13
14
15
# File 'lib/lookbook/lang.rb', line 11

def guess(path, fallback_name = nil)
  ext = File.extname(path)
  lang = languages.find { |l| l[:ext] == ext }
  lang || (find(fallback_name) if fallback_name)
end