xbel 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Introduces XBEL decorations for Nokogiri.
4
4
 
5
+ ## Features
6
+
7
+ * generates IDs for bookmarks and folders
8
+ * decorates a Nokogiri::XML::Node, all Nokogiri methods are available
9
+
5
10
  ## Installation
6
11
 
7
12
  gem install xbel
@@ -13,7 +18,7 @@ Introduces XBEL decorations for Nokogiri.
13
18
 
14
19
  ### Reading
15
20
 
16
- XBEL.open('test/wikipedia.xbel')[:f0].bookmarks.
21
+ XBEL.open('test/wikipedia.xbel')[:test_1_1].bookmarks.
17
22
  map do |bookmark|
18
23
  link_to bookmark.title, bookmark.href
19
24
  end
@@ -22,7 +27,9 @@ Introduces XBEL decorations for Nokogiri.
22
27
 
23
28
  xbel = XBEL.new
24
29
  xbel.build_folder 'XBEL' do |folder|
25
- folder.build_bookmark "boof's xbel", 'http://github.com/boof/xbel'
30
+ bm = folder.build_bookmark "boof's xbel", 'http://github.com/boof/xbel'
31
+ # nodes receive IDs and can be accessed via the :[] method
32
+ bm == xbel[bm.id]
26
33
  end
27
34
  File.open('my.xbel', 'w') { |file| file << xbel }
28
35
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -65,15 +65,15 @@ module Nokogiri::Decorators::XBEL
65
65
  add_child Nokogiri::XML::Node.new('separator', document)
66
66
  end
67
67
 
68
- protected
68
+ def generate_id
69
+ "#{ id }#{ document.div_id_er }" << xpath('./bookmark | ./folder').
70
+ inject(0) { |next_id, child|
71
+ succ_num_id = child.id[/(\d+)$/, 1].to_i.succ
72
+ succ_num_id > next_id ? succ_num_id : next_id
73
+ }.to_s
74
+ end
69
75
 
70
- def generate_id
71
- "#{ id }#{ document.div_id_er }" << xpath('./bookmark | ./folder').
72
- inject(0) { |next_id, child|
73
- succ_num_id = child.id[/(\d+)$/, 1].to_i.succ
74
- succ_num_id > next_id ? succ_num_id : next_id
75
- }.to_s
76
- end
76
+ protected
77
77
 
78
78
  def add_child(node)
79
79
  if Entry === node
@@ -88,13 +88,13 @@ module Nokogiri::Decorators::XBEL
88
88
  raise ArgumentError
89
89
  end
90
90
  end
91
-
92
- # Returns nil.
93
- def alias?; end
94
- # Returns nil.
95
- def bookmark?; end
96
- # Returns nil.
97
- def folder?; end
98
91
  end
99
92
 
93
+ # Returns nil.
94
+ def alias?; end
95
+ # Returns nil.
96
+ def bookmark?; end
97
+ # Returns nil.
98
+ def folder?; end
99
+
100
100
  end
data/test/test_xbel.rb CHANGED
@@ -146,11 +146,14 @@ context 'XBEL' do
146
146
  context 'Separator' do
147
147
  setup { topic.entries.find { |e| e.name == 'separator' } }
148
148
  asserts('to_s') { topic.to_s }.equals ' '
149
+ should('not be a bookmark') { !topic.bookmark? }
150
+ should('not be a alias') { !topic.alias? }
151
+ should('not be a folder') { !topic.folder? }
149
152
  end
150
153
 
151
154
  end
152
155
 
153
- context 'Bookmark b0' do
156
+ context 'Bookmark test_1_1' do
154
157
  setup { topic[:test_1_1] }
155
158
  should('be a bookmark') { topic.bookmark? }
156
159
 
data/xbel.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{xbel}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Florian A\303\237mann"]
12
- s.date = %q{2009-11-16}
12
+ s.date = %q{2009-11-17}
13
13
  s.description = %q{}
14
14
  s.email = %q{florian.assmann@email.de}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xbel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Florian A\xC3\x9Fmann"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-16 00:00:00 +01:00
12
+ date: 2009-11-17 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency