nokolexbor 0.3.7-x86_64-linux → 0.4.1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nokolexbor/2.6/nokolexbor.so +0 -0
- data/lib/nokolexbor/2.7/nokolexbor.so +0 -0
- data/lib/nokolexbor/3.0/nokolexbor.so +0 -0
- data/lib/nokolexbor/3.1/nokolexbor.so +0 -0
- data/lib/nokolexbor/3.2/nokolexbor.so +0 -0
- data/lib/nokolexbor/node_set.rb +79 -0
- data/lib/nokolexbor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb4bdf4918d96847151771c1a9b18dc406ff7d097c5d6c92c17841c8a0e208e0
|
4
|
+
data.tar.gz: db0111683768a8dc3ff68427e47c454207dcf0381166dfaeae947570a1cd219a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c73bfed686cb3856d0e398e79e1557fe0065e28227614edc3cab3f213125a1b5556a5efc557654aa0aa7c5d46712461e16f1c707a6f439dbd85d8939d975a020
|
7
|
+
data.tar.gz: 7f0ccac203dc8b1dc757e4c61d44192b20b5b7a159c7ad569139c700d0d3d887bf9de37c3ddd4515b25a4f5df509dca161ecd815bd5c3c7628ea279369a4b28c
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/nokolexbor/node_set.rb
CHANGED
@@ -54,6 +54,16 @@ module Nokolexbor
|
|
54
54
|
length == 0
|
55
55
|
end
|
56
56
|
|
57
|
+
# Insert +node+ before the first Node in this NodeSet
|
58
|
+
def before(node)
|
59
|
+
first.before(node)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Insert +node+ after the last Node in this NodeSet
|
63
|
+
def after(node)
|
64
|
+
last.after(node)
|
65
|
+
end
|
66
|
+
|
57
67
|
# @return [Integer] The index of the first node in this NodeSet that is equal to +node+ or meets the given block. Returns nil if no match is found.
|
58
68
|
def index(node = nil)
|
59
69
|
if node
|
@@ -169,6 +179,75 @@ module Nokolexbor
|
|
169
179
|
self
|
170
180
|
end
|
171
181
|
|
182
|
+
# Add the class attribute +name+ to all containing nodes.
|
183
|
+
#
|
184
|
+
# @see Node#add_class
|
185
|
+
def add_class(name)
|
186
|
+
each do |el|
|
187
|
+
el.add_class(name)
|
188
|
+
end
|
189
|
+
self
|
190
|
+
end
|
191
|
+
|
192
|
+
# Append the class attribute +name+ to all containing nodes.
|
193
|
+
#
|
194
|
+
# @see Node#append_class
|
195
|
+
def append_class(name)
|
196
|
+
each do |el|
|
197
|
+
el.append_class(name)
|
198
|
+
end
|
199
|
+
self
|
200
|
+
end
|
201
|
+
|
202
|
+
# Remove the class attribute +name+ from all containing nodes.
|
203
|
+
#
|
204
|
+
# @see Node#remove_class
|
205
|
+
def remove_class(name = nil)
|
206
|
+
each do |el|
|
207
|
+
el.remove_class(name)
|
208
|
+
end
|
209
|
+
self
|
210
|
+
end
|
211
|
+
|
212
|
+
# Remove the attributed named +name+ from all containing nodes.
|
213
|
+
#
|
214
|
+
# @see Node#remove_attr
|
215
|
+
def remove_attr(name)
|
216
|
+
each { |el| el.delete(name) }
|
217
|
+
self
|
218
|
+
end
|
219
|
+
alias_method :remove_attribute, :remove_attr
|
220
|
+
|
221
|
+
# Set attributes on each Node in the NodeSet, or get an
|
222
|
+
# attribute from the first Node in the NodeSet.
|
223
|
+
#
|
224
|
+
# @example Get an attribute from the first Node in a NodeSet.
|
225
|
+
# node_set.attr("href")
|
226
|
+
#
|
227
|
+
# @example Set attributes on each node.
|
228
|
+
# node_set.attr("href" => "http://example.com", "class" => "a")
|
229
|
+
# node_set.attr("href", "http://example.com")
|
230
|
+
# node_set.attr("href") { |node| "http://example.com" }
|
231
|
+
#
|
232
|
+
# @return [NodeSet] +self+, to support chaining of calls.
|
233
|
+
def attr(key, value = nil, &block)
|
234
|
+
unless key.is_a?(Hash) || (key && (value || block))
|
235
|
+
return first&.attribute(key)
|
236
|
+
end
|
237
|
+
|
238
|
+
hash = key.is_a?(Hash) ? key : { key => value }
|
239
|
+
|
240
|
+
hash.each do |k, v|
|
241
|
+
each do |node|
|
242
|
+
node[k] = v || yield(node)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
self
|
247
|
+
end
|
248
|
+
alias_method :set, :attr
|
249
|
+
alias_method :attribute, :attr
|
250
|
+
|
172
251
|
# (see Node#xpath)
|
173
252
|
def xpath(*args)
|
174
253
|
paths, handler, ns, binds = extract_params(args)
|
data/lib/nokolexbor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokolexbor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Yicheng Zhou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|