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-1.3.4 lib/lookbook/lang.rb
lookbook-1.3.3 lib/lookbook/lang.rb
lookbook-1.3.1 lib/lookbook/lang.rb
lookbook-1.3.0 lib/lookbook/lang.rb
lookbook-1.2.1 lib/lookbook/lang.rb
lookbook-1.2.0 lib/lookbook/lang.rb
lookbook-1.1.1 lib/lookbook/lang.rb
lookbook-1.1.0 lib/lookbook/lang.rb
lookbook-1.0.8 lib/lookbook/lang.rb
lookbook-0.9.8 lib/lookbook/lang.rb
lookbook-1.0.7 lib/lookbook/lang.rb
lookbook-1.0.6 lib/lookbook/lang.rb
lookbook-1.0.5 lib/lookbook/lang.rb
lookbook-1.0.4 lib/lookbook/lang.rb
lookbook-1.0.3 lib/lookbook/lang.rb
lookbook-1.0.2 lib/lookbook/lang.rb
lookbook-1.0.1 lib/lookbook/lang.rb
lookbook-1.0.0 lib/lookbook/lang.rb
lookbook-1.0.0.rc.3 lib/lookbook/lang.rb
lookbook-0.9.7 lib/lookbook/lang.rb