http_accept 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/http_accept/parser.rb +5 -1
  2. metadata +1 -1
@@ -14,9 +14,13 @@ module HTTPAccept
14
14
 
15
15
  private
16
16
 
17
+ PARAM_PATTERN = /((\w+)\s*=\s*'([\w.]+)'|(\w+)\s*=\s*"?([\w.]+)"?)/
18
+
17
19
  def parse_params(segment)
18
20
  format, *params = segment.split(";")
19
- params = Hash[*params.map { |p| p.scan(/(\w+)=([\w.]+)/) }.flatten]
21
+ arr = params.map { |p| p.scan(PARAM_PATTERN).map { |a| a.drop(1) } }.
22
+ flatten.compact
23
+ params = Hash[*arr]
20
24
  return [format, params]
21
25
  end
22
26
  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.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: