Sha256: ec74f18491e49a3dfa8182723af4149ee196a5016972e42b6dfdae6ef8dacfe3

Contents?: true

Size: 892 Bytes

Versions: 4

Compression:

Stored size: 892 Bytes

Contents

require 'linguist'

require_relative 'registerable'
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'
require_relative 'language/unknown'

module LintTrap
  # Language registry
  module Language
    extend Registerable

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

        find(language && language.name)
      end
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lint_trap-0.0.19 lib/lint_trap/language.rb
lint_trap-0.0.18 lib/lint_trap/language.rb
lint_trap-0.0.17 lib/lint_trap/language.rb
lint_trap-0.0.16 lib/lint_trap/language.rb