http_accept 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/http_accept/media_type.rb +12 -2
- metadata +2 -2
@@ -12,9 +12,15 @@ module HTTPAccept
|
|
12
12
|
def <=>(other)
|
13
13
|
# return -1 if more specific than other, so we end up at the front of the
|
14
14
|
# array
|
15
|
-
if
|
15
|
+
if q > other.q
|
16
16
|
-1
|
17
|
-
elsif
|
17
|
+
elsif q < other.q
|
18
|
+
1
|
19
|
+
elsif !all_subtypes? && other.all_subtypes? ||
|
20
|
+
!all_types? && other.all_types?
|
21
|
+
-1
|
22
|
+
elsif all_subtypes? && !other.all_subtypes? ||
|
23
|
+
all_types? && !other.all_types?
|
18
24
|
1
|
19
25
|
elsif params.count == other.params.count
|
20
26
|
0
|
@@ -33,6 +39,10 @@ module HTTPAccept
|
|
33
39
|
format == "*/*"
|
34
40
|
end
|
35
41
|
|
42
|
+
def q
|
43
|
+
params["q"] ? params["q"].to_f : 1.0
|
44
|
+
end
|
45
|
+
|
36
46
|
def to_h
|
37
47
|
{ :format => format, :params => params }
|
38
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_accept
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: brandur@mutelight.org
|