wurfl-lite 1.1.4 → 1.1.5

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.
@@ -1,6 +1,6 @@
1
1
  require 'open-uri'
2
2
  require 'zlib'
3
- require 'hpricot'
3
+ require 'nokogiri'
4
4
  require 'amatch'
5
5
 
6
6
  class WURFL
@@ -51,18 +51,18 @@ class WURFL
51
51
  data = Zlib::GzipReader.new(StringIO.new(data.to_s)).read
52
52
  rescue Zlib::GzipFile::Error
53
53
  end
54
- doc = Hpricot( data )
54
+ doc = Nokogiri::XML( data )
55
55
 
56
56
  keys_added = []
57
57
 
58
- (doc/'devices'/'device').each do |device_element|
58
+ doc.xpath("//devices/device").each do |device_element|
59
59
  device = Hash.new
60
60
  %w|id user_agent fall_back|.each do |attribute|
61
- device[ attribute.to_sym ] = device_element.attributes[ attribute ]
61
+ device[ attribute.to_sym ] = device_element[ attribute ].to_s
62
62
  end
63
- (device_element/'capability').each do |capability|
64
- name = capability.attributes[ 'name' ].to_sym
65
- value = capability.attributes[ 'value' ]
63
+ device_element.xpath("*/capability").each do |capability|
64
+ name = capability[ 'name' ].to_sym
65
+ value = capability[ 'value' ].to_s
66
66
  next if value.empty?
67
67
  if value.to_i.to_s == value.strip
68
68
  value = value.to_i
@@ -76,11 +76,11 @@ class WURFL
76
76
  @devices[ device[ :user_agent ] ] = device
77
77
  @devices_by_id[ device[ :id ] ] = device
78
78
  end
79
-
79
+
80
80
  keys_added.each do |key|
81
81
  @devices[ key ][ :fall_back ] = @devices_by_id[ @devices[ key ][ :fall_back ] ]
82
82
  end
83
-
83
+
84
84
  end
85
85
 
86
86
  def []( user_agent )
@@ -1,3 +1,3 @@
1
1
  class WURFL
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{Simple Ruby usage of the WURFL device capabilities and features database}
13
13
  s.description = %q{Simple Ruby usage of the WURFL device capabilities and features database}
14
14
 
15
- s.add_dependency "hpricot", ">= 0.8.2", "!= 0.8.3"
15
+ s.add_dependency "nokogiri", ">= 1.5.5"
16
16
  s.add_dependency "amatch", ">= 0.2.5"
17
17
 
18
18
  s.add_development_dependency "bundler", ">= 1.0.0"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wurfl-lite
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.4
5
+ version: 1.1.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Clive Crous
@@ -10,19 +10,16 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-06-28 00:00:00 Z
13
+ date: 2012-07-06 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: hpricot
16
+ name: nokogiri
17
17
  requirement: &id001 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.8.2
23
- - - "!="
24
- - !ruby/object:Gem::Version
25
- version: 0.8.3
22
+ version: 1.5.5
26
23
  type: :runtime
27
24
  prerelease: false
28
25
  version_requirements: *id001
@@ -89,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
86
  requirements:
90
87
  - - ">="
91
88
  - !ruby/object:Gem::Version
92
- hash: 741124909
89
+ hash: -917679183
93
90
  segments:
94
91
  - 0
95
92
  version: "0"
@@ -98,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
95
  requirements:
99
96
  - - ">="
100
97
  - !ruby/object:Gem::Version
101
- hash: 741124909
98
+ hash: -917679183
102
99
  segments:
103
100
  - 0
104
101
  version: "0"