accept_language 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/VERSION.semver +1 -1
- data/lib/accept_language/intersection.rb +2 -2
- data/lib/accept_language/parser.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d350dc26f69d89636ac4794c3a9d678cdf44f3f849c1f640b38c959da3637f9
|
|
4
|
+
data.tar.gz: ce3bd0c7254ebc9d3dbad9ca6d7503fd6c2dcf396232c0641a8de56872bd97fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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
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-
|
|
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
|
+
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
|
|
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
|
|
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.
|
|
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
|
+
date: 2019-06-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|