Sha256: d8704817b7bdb07b5c49c457f54779ce1d6a4a28f920672c6e7a23d607873fb5

Contents?: true

Size: 981 Bytes

Versions: 4

Compression:

Stored size: 981 Bytes

Contents

require 'linguist'

require_relative 'language/coffeescript'
require_relative 'language/cpp'
require_relative 'language/css'
require_relative 'language/go'
require_relative 'language/java'
require_relative 'language/javascript'
require_relative 'language/json'
require_relative 'language/python'
require_relative 'language/ruby'
require_relative 'language/scss'

module LintTrap
  # Language lookup
  module Language
    @languages = {}

    class << self
      def register(language)
        languages[language.canonical_name] = language
      end

      def detect(file)
        language = Linguist::FileBlob.new(file).language

        find(language.name)
      end

      def find(name)
        languages[name]
      end

    protected

      attr_reader :languages
    end

    register CoffeeScript
    register CPP
    register CSS
    register Go
    register Java
    register JavaScript
    register JSON
    register Python
    register Ruby
    register SCSS
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lint_trap-0.0.6 lib/lint_trap/language.rb
lint_trap-0.0.5 lib/lint_trap/language.rb
lint_trap-0.0.4 lib/lint_trap/language.rb
lint_trap-0.0.3 lib/lint_trap/language.rb