nokolexbor 0.4.2-x64-mingw-ucrt → 0.5.2-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d35658daa78ce46c723a8dea5557f7b3efeddc097e6cce88d2b1d4c8371ef3c0
4
- data.tar.gz: 65b6a69ec504258da2e687a88088717373f603dfd889cb929ac0fcaf026b2a03
3
+ metadata.gz: 15753c37b7bd98fda55d2689b0604942bc81aad591e5b1c52245defd9aacd33c
4
+ data.tar.gz: ca8ccf72a03dbcd50ab58d0de81efda22b04cc19f5a06c5198ccbf0c02a83837
5
5
  SHA512:
6
- metadata.gz: a1919a82d1f11ed08866e61ac5dfb223a5eff77a350d9544688c050b983a79894731f839c98e593587e9ce6b1b85ad4b9e60f7e23514a853bd368dd98126520e
7
- data.tar.gz: 85429ba89cd1be2c6e00d03559b65f555f4a0aa62a2da5af4e70544ae9408503d0be4a871ab74e801b9e2cd80e0c0f66231cd92440ba5073d8aa1e27a34a3409
6
+ metadata.gz: b15d1f644d6955e77e20b4323ac2bddd0bac983aa33ce79a21de02d8ee09cd15e0ae7fdc1f98a35bb664d41fda451f3921ef3ec63be24af34a6b60c1e2e8cd7e
7
+ data.tar.gz: 31ae91bf0d42f896d69cd3826d5b45ae1dc04c2394fa5667e6095a814cc7649800a8d1e6303585b1cd1dd62d7f6695d4891261ad53275efbadaa4f64d2e1ac9c
Binary file
Binary file
@@ -51,12 +51,20 @@ module Nokolexbor
51
51
  def element?
52
52
  type == ELEMENT_NODE
53
53
  end
54
+ alias_method :elem?, :element?
54
55
 
55
56
  # @return true if this is a {Document}
56
57
  def document?
57
58
  is_a?(Nokolexbor::Document)
58
59
  end
59
60
 
61
+ # Get the path to this node as a CSS expression
62
+ def css_path
63
+ path.split(%r{/}).filter_map do |part|
64
+ part.empty? ? nil : part.gsub(/\[(\d+)\]/, ':nth-of-type(\1)')
65
+ end.join(" > ")
66
+ end
67
+
60
68
  # Get a list of ancestor Node of this Node
61
69
  #
62
70
  # @param [String, nil] selector The selector to match ancestors
@@ -285,6 +293,11 @@ module Nokolexbor
285
293
  parent_node.add_child(self)
286
294
  end
287
295
 
296
+ # @return true if this Node's attributes include <value>
297
+ def value?(value)
298
+ values.include?(value)
299
+ end
300
+
288
301
  # Iterate over each attribute name and value pair of this Node.
289
302
  #
290
303
  # @yield [String,String] The name and value of the current attribute.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nokolexbor
4
- VERSION = '0.4.2'
4
+ VERSION = '0.5.2'
5
5
  end
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.2
4
+ version: 0.5.2
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Yicheng Zhou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-05 00:00:00.000000000 Z
11
+ date: 2023-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler