accept_language 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3142222cf1c1e744eb2cca5dd3b023b886b4ea048d65803db47966f009e999d8
4
- data.tar.gz: c5f9cbffdac71ed1cab9db74935a83f2f4f2e222ec0a1c0916fd8e396a5f3ad9
3
+ metadata.gz: 3d350dc26f69d89636ac4794c3a9d678cdf44f3f849c1f640b38c959da3637f9
4
+ data.tar.gz: ce3bd0c7254ebc9d3dbad9ca6d7503fd6c2dcf396232c0641a8de56872bd97fa
5
5
  SHA512:
6
- metadata.gz: 7b5b728adb53b60438034e047c7264f34c1cedcfc1e8cbc6a82cc7abfa5ea8d0d9cbe7c838596f38f1cd284c3cfeb5f0858027d083f8aa0870b0e7184d5ed181
7
- data.tar.gz: f45a8dae464de3d5f5e70feefec06560c4165078276053e90c3458e72a1584d253316c6d6b21f886068b69b02bfec877d2d8df11c20af3833590c6dc18b2fbc9
6
+ metadata.gz: 8a2c7f1ca2b56dc774aa2c62dc1ab58cf0ed25dc2dd02e55f9a5c7fafe162480855068222a1cc73aeeefe4ec594abb72bebdcf7adbf179b786015837ca9abb27
7
+ data.tar.gz: 177e781389b91cf7e9a2bc572e318abef16fd4d6267fb83a61cc2d0f6609106b39a56f85ea0f8a5d6070fb924c49d69c0262e828b983b275fc069a725ba1885d
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-06-12 01:35:53 +0200 using RuboCop version 0.71.0.
3
+ # on 2019-06-12 08:15:50 +0200 using RuboCop version 0.71.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -8,20 +8,20 @@
8
8
 
9
9
  # Offense count: 1
10
10
  Metrics/AbcSize:
11
- Max: 16
11
+ Max: 19
12
12
 
13
13
  # Offense count: 1
14
14
  # Configuration parameters: CountComments, ExcludedMethods.
15
15
  # ExcludedMethods: refine
16
16
  Metrics/BlockLength:
17
- Max: 72
17
+ Max: 80
18
18
 
19
19
  # Offense count: 1
20
20
  # Configuration parameters: CountComments, ExcludedMethods.
21
21
  Metrics/MethodLength:
22
22
  Max: 11
23
23
 
24
- # Offense count: 14
24
+ # Offense count: 15
25
25
  # Cop supports --auto-correct.
26
26
  # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
27
27
  # URISchemes: http, https
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- accept_language (0.1.1)
4
+ accept_language (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -32,7 +32,7 @@ It's intended to be used in a Web server that supports some level of internation
32
32
 
33
33
  ```ruby
34
34
  AcceptLanguage.parse('da, en-gb;q=0.8, en;q=0.7') # => [:da, :"en-gb", :en]
35
- AcceptLanguage.parse('fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5') # => [:"fr-CH", :fr, :en, :de, :*]
35
+ AcceptLanguage.parse('fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5') # => [:"fr-ch", :fr, :en, :de, :*]
36
36
  ```
37
37
 
38
38
  In order to help facilitate better i18n, a method is provided to return the intersection of the languages the user prefers and the languages your application supports.
data/VERSION.semver CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -12,8 +12,8 @@ module AcceptLanguage
12
12
 
13
13
  def initialize(accepted_languages, default_supported_language, *other_supported_languages, truncate: true)
14
14
  @accepted_languages = Parser.new(accepted_languages).call
15
- @default_supported_language = default_supported_language.to_sym
16
- @other_supported_languages = other_supported_languages.map(&:to_sym).to_set
15
+ @default_supported_language = default_supported_language.to_sym.downcase
16
+ @other_supported_languages = other_supported_languages.map { |lang| lang.to_sym.downcase }.to_set
17
17
 
18
18
  return unless truncate
19
19
 
@@ -21,6 +21,8 @@ module AcceptLanguage
21
21
  def preferences
22
22
  @string.delete(' ').split(',').inject({}) do |result, language|
23
23
  tag, quality = language.split(/;q=/i)
24
+
25
+ tag = tag.downcase
24
26
  quality = quality.nil? ? 1.0 : quality.to_f
25
27
 
26
28
  next result if quality.zero?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accept_language
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-11 00:00:00.000000000 Z
11
+ date: 2019-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler