Sha256: 3219b94471a5407cabf681a58be6e1bc8cbf1f7a7868c89c0f49dc7ddc605bb7

Contents?: true

Size: 913 Bytes

Versions: 64

Compression:

Stored size: 913 Bytes

Contents

module Lookbook
  module Lang
    class << self
      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 -->"
        }
      ]

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

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

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
lookbook-0.5.0.beta.1 lib/lookbook/lang.rb
lookbook-0.5.0.beta.0 lib/lookbook/lang.rb
lookbook-0.4.8 lib/lookbook/lang.rb
lookbook-0.4.7 lib/lookbook/lang.rb