aua 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES.md CHANGED
@@ -1,6 +1,12 @@
1
1
  ### dev
2
2
 
3
- [full changelog](http://github.com/yolk/aua/compare/v0.1.0...master)
3
+ [full changelog](http://github.com/yolk/aua/compare/v0.1.1...master)
4
+
5
+ ### 0.1.1 / 2011-01-28
6
+
7
+ [full changelog](http://github.com/yolk/aua/compare/v0.1.0...v0.1.1)
8
+
9
+ * Added type :Unknown and output raw user agent string on Aua#name on unknown strings
4
10
 
5
11
  ### 0.1.0 / 2011-01-27
6
12
 
data/aua.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Sebastian Munz"]
10
10
  s.email = ["sebastian@yo.lk"]
11
- s.homepage = "http://rubygems.org/gems/aua"
11
+ s.homepage = "https://github.com/yolk/aua"
12
12
  s.summary = %q{aua = a user agent (parser).}
13
13
  s.description = %q{aua = a user agent (parser).}
14
14
 
data/lib/aua/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Aua
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/aua.rb CHANGED
@@ -26,7 +26,15 @@ class Aua
26
26
  Aua::OperatingSystems.extend_agent(self)
27
27
  end
28
28
 
29
- attr_reader :type, :name, :version, :os_name, :os_version, :parts, :raw, :platform
29
+ attr_reader :version, :os_name, :os_version, :parts, :raw, :platform
30
+
31
+ def name
32
+ unknown? ? raw : @name
33
+ end
34
+
35
+ def type
36
+ @type || :Unknown
37
+ end
30
38
 
31
39
  def products
32
40
  @products ||= parts.map{|p| p[0] }
@@ -74,7 +82,7 @@ class Aua
74
82
  end
75
83
 
76
84
  def unknown?
77
- !name.is_a?(Symbol)
85
+ type == :Unknown
78
86
  end
79
87
 
80
88
  def to_s
data/spec/aua_spec.rb CHANGED
@@ -421,8 +421,8 @@ describe Aua do
421
421
  its(:os_string) { should eql(nil) }
422
422
  its(:platform_string) { should eql(nil) }
423
423
 
424
- its(:name) { should eql(nil) }
425
- its(:type) { should eql(nil) }
424
+ its(:name) { should eql("") }
425
+ its(:type) { should eql(:Unknown) }
426
426
  its(:version) { should eql(nil) }
427
427
  its(:os_name) { should eql(nil) }
428
428
  its(:os_version) { should eql(nil) }
@@ -470,5 +470,12 @@ describe Aua do
470
470
 
471
471
  it{ should be_unknown }
472
472
  its(:to_s) { should eql("Unknown: Mozilla/5.0 (Bla; U; Krank; de; rv:1.9.2.13) Less/20101203 Vrrrr/3.6.13")}
473
+
474
+ its(:name) { should eql("Mozilla/5.0 (Bla; U; Krank; de; rv:1.9.2.13) Less/20101203 Vrrrr/3.6.13") }
475
+ its(:type) { should eql(:Unknown) }
476
+ its(:version) { should eql(nil) }
477
+ its(:os_name) { should eql(nil) }
478
+ its(:os_version) { should eql(nil) }
479
+ its(:platform) { should eql(nil) }
473
480
  end
474
481
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sebastian Munz
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-27 00:00:00 +01:00
17
+ date: 2011-01-28 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -124,7 +124,7 @@ files:
124
124
  - spec/aua_spec.rb
125
125
  - spec/spec_helper.rb
126
126
  has_rdoc: true
127
- homepage: http://rubygems.org/gems/aua
127
+ homepage: https://github.com/yolk/aua
128
128
  licenses: []
129
129
 
130
130
  post_install_message: