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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a7f746dc94e3b5c11723e592682f5a8cd7059ee
4
- data.tar.gz: c96d725eddaf783346e22794a8fd2d0b35b1a23b
3
+ metadata.gz: a2fcbdc6b5f7e1e3cc175971bfd4e2649774b4fe
4
+ data.tar.gz: 671c3b4ff9b5a4d2b94ca08d9ab380a4f8a8f498
5
5
  SHA512:
6
- metadata.gz: a7747cc2209e7a651ef8f78fe96571929b930ac0f4274b8df11ce373673f06be47b9ed5f1955dd33c58d83b91fe4c3a95288b803a0601de5a3d198f0b7358c34
7
- data.tar.gz: c69414ed28b553888a5912ccd59d86eb32f3cbebbfc355b2aa5c51084fb62bfca807db60bad584d548d22c150f1899f5a631c8518d6cefe00b003cbe4a3e974c
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
- if object = @media_types[type][subtype]
61
- return object, media_range
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
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module HTTP
22
22
  module Accept
23
- VERSION = "1.1.2"
23
+ VERSION = "1.1.3"
24
24
  end
25
25
  end
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.2
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-05 00:00:00.000000000 Z
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.4.8
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.