Sha256: ed14372339be87e9a13f8048d4f8c5fabe63f4731409e515ceb61088ce8e7b0c

Contents?: true

Size: 576 Bytes

Versions: 5

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

module Wordlist
  class Lexer
    #
    # Detects the system's default language.
    #
    # @api semipublic
    #
    # @since 1.0.0
    #
    module Lang
      #
      # The default language.
      #
      # @return [Symbol]
      #
      def self.default
        if (lang = ENV['LANG'])
          lang, encoding = lang.split('.',2)
          lang, country = lang.split('_',2)

          unless lang == 'C'
            lang.to_sym
          else
            :en
          end
        else
          :en
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wordlist-1.1.1 lib/wordlist/lexer/lang.rb
wordlist-1.1.0 lib/wordlist/lexer/lang.rb
wordlist-1.0.3 lib/wordlist/lexer/lang.rb
wordlist-1.0.2 lib/wordlist/lexer/lang.rb
wordlist-1.0.1 lib/wordlist/lexer/lang.rb