nokolexbor 0.4.1-x86_64-linux → 0.5.0-x86_64-linux

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb4bdf4918d96847151771c1a9b18dc406ff7d097c5d6c92c17841c8a0e208e0
4
- data.tar.gz: db0111683768a8dc3ff68427e47c454207dcf0381166dfaeae947570a1cd219a
3
+ metadata.gz: fc0ef769231cbdea01abfb16801a8d5966010b603066029fb4cb6bb72dd8dea0
4
+ data.tar.gz: b0d9a49050a4b37155a4c76159e716cb84fb5d7f9bcf8cfd056a3f6f2bfa207d
5
5
  SHA512:
6
- metadata.gz: c73bfed686cb3856d0e398e79e1557fe0065e28227614edc3cab3f213125a1b5556a5efc557654aa0aa7c5d46712461e16f1c707a6f439dbd85d8939d975a020
7
- data.tar.gz: 7f0ccac203dc8b1dc757e4c61d44192b20b5b7a159c7ad569139c700d0d3d887bf9de37c3ddd4515b25a4f5df509dca161ecd815bd5c3c7628ea279369a4b28c
6
+ metadata.gz: 63634188af8518a3c25620c36f712efd344b6992cb6f731984e4ffb11e06dc9e30103e9577160f56c815d00038a5ee6154f5d53d02d9327201aa293d5980b300
7
+ data.tar.gz: 0f6f772451d1e37b8d9d2d58dec3fbd47f8ff972d3409082eba328c26e41092fa92edb05553933eeff49cd3cb900dd1290429d3e64f74524938dcd0b55fd4804
Binary file
Binary file
Binary file
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.1'
4
+ VERSION = '0.5.0'
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.1
4
+ version: 0.5.0
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-04-04 00:00:00.000000000 Z
11
+ date: 2023-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler