nokogiri-plist 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri-plist
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 17
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 0
9
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Casey Howard
@@ -14,10 +15,37 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-30 00:00:00 -07:00
18
+ date: 2010-08-08 00:00:00 -07:00
18
19
  default_executable:
19
- dependencies: []
20
-
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: shoulda
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: nokogiri
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
21
49
  description: Allows Nokogiri objects to be converted to PLists
22
50
  email:
23
51
  - caseyhoward@caseyhoward.com
@@ -31,10 +59,7 @@ files:
31
59
  - lib/nokogiri-plist.rb
32
60
  - lib/string.rb
33
61
  - lib/nokogiri/plist/parser.rb
34
- - lib/nokogiri/plist/parser.rb~
35
62
  - lib/nokogiri/plist/generator.rb
36
- - lib/nokogiri/plist.rb~
37
- - lib/nokogiri/xml/node.rb~
38
63
  - lib/nokogiri/xml/node.rb
39
64
  - lib/nokogiri/plist.rb
40
65
  - LICENSE
@@ -49,16 +74,20 @@ rdoc_options: []
49
74
  require_paths:
50
75
  - lib
51
76
  required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
52
78
  requirements:
53
79
  - - ">="
54
80
  - !ruby/object:Gem::Version
81
+ hash: 3
55
82
  segments:
56
83
  - 0
57
84
  version: "0"
58
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
59
87
  requirements:
60
88
  - - ">="
61
89
  - !ruby/object:Gem::Version
90
+ hash: 23
62
91
  segments:
63
92
  - 1
64
93
  - 3
@@ -67,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
96
  requirements: []
68
97
 
69
98
  rubyforge_project:
70
- rubygems_version: 1.3.6
99
+ rubygems_version: 1.3.7
71
100
  signing_key:
72
101
  specification_version: 3
73
102
  summary: PList parsing capabilities built using Nokogiri
@@ -1,66 +0,0 @@
1
- module Nokogiri
2
-
3
- module PList
4
-
5
- class Parser
6
-
7
- class << self
8
-
9
- def parse(xml, options={})
10
- @converters = {
11
- 'integer' => Proc.new { |node| node.content.to_i },
12
- 'real' => Proc.new { |node| node.content.to_f },
13
- 'string' => Proc.new { |node| node.content.to_s },
14
- 'date' => Proc.new { |node| DateTime.parse(node.content) },
15
- 'true' => Proc.new { |node| true },
16
- 'false' => Proc.new { |node| false },
17
- 'dict' => Proc.new { |node| parse_dict node },
18
- 'array' => Proc.new { |node| parse_array node },
19
- 'data' => Proc.new { |node| node.content.to_s }
20
- }.merge(options[:converters] || {})
21
- @dict_class = options[:dict_class] || Hash
22
- plist = xml.root
23
- plist = plist.children.first if plist.name == "plist"
24
- parse_value_node next_valid_sibling plist
25
- end
26
-
27
- def parse_value_node(value_node)
28
- @converters[value_node.name].call(value_node)
29
- end
30
-
31
- def valid_type?(type)
32
- not @converters[type].nil?
33
- end
34
-
35
- def valid_node?(node)
36
- valid_type?(node.name) or node.name == "key"
37
- end
38
-
39
- def parse_dict(node)
40
- node.xpath('./key').inject(@dict_class.new) do |return_value, key_node|
41
- return_value[key_node.content] = parse_value_node(next_valid_sibling key_node)
42
- return_value
43
- end
44
- end
45
-
46
- def parse_array(node)
47
- node.children.inject([]) do |return_value, node|
48
- return_value << parse_value_node(node) if valid_node? node
49
- return_value
50
- end
51
- end
52
-
53
- def next_valid_sibling(node)
54
- until node.nil? or valid_type? node.name
55
- node = node.next_sibling
56
- end
57
- node
58
- end
59
-
60
- end
61
-
62
- end
63
-
64
- end
65
-
66
- end
@@ -1,11 +0,0 @@
1
- module Nokogiri
2
-
3
- class << self
4
-
5
- def PList(xml)
6
- Nokogiri::PList::Parser.parsea(Nokogiri::XML(xml))
7
- end
8
-
9
- end
10
-
11
- end
@@ -1,15 +0,0 @@
1
- module Nokogiri
2
-
3
- module XML
4
-
5
- class Node
6
-
7
- def to_plist
8
- Nokogiri::PList::Parser.new.parse(self)
9
- end
10
-
11
- end
12
-
13
- end
14
-
15
- end