useragent 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/user_agent.rb +6 -0
- data/lib/user_agent/browsers/gecko.rb +2 -1
- metadata +4 -4
data/lib/user_agent.rb
CHANGED
@@ -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])
|
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:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joshua Peek
|