useragent 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,13 @@ class UserAgent
11
11
  (\s\(([^\)]*)\))? # Comment
12
12
  }x.freeze
13
13
 
14
+ DEFAULT_USER_AGENT = "Mozilla/4.0 (compatible)"
15
+
14
16
  def self.parse(string)
17
+ if string.nil? || string == ""
18
+ string = DEFAULT_USER_AGENT
19
+ end
20
+
15
21
  agents = []
16
22
  while m = string.to_s.match(MATCHER)
17
23
  agents << new(m[1], m[2], m[4])
@@ -21,7 +21,8 @@ class UserAgent
21
21
  end
22
22
 
23
23
  def platform
24
- application.comment[0]
24
+ platform = application.comment[0]
25
+ platform == 'compatible' ? nil : platform
25
26
  end
26
27
 
27
28
  def security
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: useragent
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 2
10
- version: 0.3.2
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Peek