Module: Lookbook::Lang

Defined in:
lib/lookbook/lang.rb

Constant Summary collapse

LANGUAGES =
[
  {
    name: "ruby",
    ext: ".rb",
    label: "Ruby",
    comment: "# %s"
  },
  {
    name: "html",
    ext: ".html",
    label: "HTML",
    comment: "<!-- %s -->"
  },
  {
    name: "erb",
    ext: ".erb",
    label: "ERB",
    comment: "<%%# %s %%>"
  },
  {
    name: "haml",
    ext: ".haml",
    label: "Haml",
    comment: "<!-- %s -->"
  },
  {
    name: "slim",
    ext: ".slim",
    label: "Slim",
    comment: "<!-- %s -->"
  }
]

Class Method Summary collapse

Class Method Details

.find(name) ⇒ Object



37
38
39
# File 'lib/lookbook/lang.rb', line 37

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

.guess(path) ⇒ Object



41
42
43
44
# File 'lib/lookbook/lang.rb', line 41

def guess(path)
  ext = File.extname(path)
  LANGUAGES.find { |l| l[:ext] == ext }
end