http-accept 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/http/accept/media_types.rb +5 -2
- data/lib/http/accept/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2fcbdc6b5f7e1e3cc175971bfd4e2649774b4fe
|
4
|
+
data.tar.gz: 671c3b4ff9b5a4d2b94ca08d9ab380a4f8a8f498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17f635535d0cb476d90d3fa8ed132c5599f14ed71acb8c3aa6db3c9c615e55beb1081813342109bc04172beddb3689248c22598a4c3584a08fd527302259b597
|
7
|
+
data.tar.gz: cf4474a4a0f87ec94dc748724b86a2216250cacdf02cf1f056483efe16d4b7e7627638aa3881e65c27aa77a810b6bb77a7e2b57f81b027061f70e51e0e8f136f
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ You can parse the incoming `Accept-Language:` header:
|
|
77
77
|
|
78
78
|
expect(languages[0].locale).to be == "da"
|
79
79
|
expect(languages[1].locale).to be == "en-gb"
|
80
|
-
expect(languages[2].locale).to be == "en"
|
80
|
+
expect(languages[2].locale).to be == "en"
|
81
81
|
|
82
82
|
Normally, you'd want to match the languages against some set of available localizations:
|
83
83
|
|
@@ -57,8 +57,11 @@ module HTTP
|
|
57
57
|
media_types.each do |media_range|
|
58
58
|
type, subtype = media_range.split
|
59
59
|
|
60
|
-
|
61
|
-
|
60
|
+
# TODO: Could be improved using dig?
|
61
|
+
if major_type = @media_types.fetch(type, nil)
|
62
|
+
if object = major_type.fetch(subtype, nil)
|
63
|
+
return object, media_range
|
64
|
+
end
|
62
65
|
end
|
63
66
|
end
|
64
67
|
|
data/lib/http/accept/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-accept
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.5.2
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Parse Accept and Accept-Language HTTP headers.
|