nokolexbor 0.4.1-x86_64-darwin → 0.5.0-x86_64-darwin

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: e525353da2ea2a9bedf34e0630eda794498b7ec3d836f8ea8b20ec8c586c3961
4
- data.tar.gz: aae390eeef08537a328d9ab6c69811e163a6dce8323e960267a182ecda6d44b8
3
+ metadata.gz: fbe49f08a9e8bcd102269daa7a52194bf8b1909c54cad54fa124811d52ce14a7
4
+ data.tar.gz: 9780f0912e37ea1e4f2dc6500fe541cafc44722eca1e259a4e9c3bb632c89014
5
5
  SHA512:
6
- metadata.gz: 14defb964b5ffde5f2380a521473e50a8122b8737b9ea6a0602fe4b46b0f2e7eb90b59f446339721284220a01067d102f7b4e8caeebeb4e7f2cbba34a3e30a20
7
- data.tar.gz: 0b71b3d4e4b6d6cce1bf85767d3d4abdfd6c6eb24e283e892fbbf0ee2126949a8d3fb217fd9b048445039f0f19db2fa98ca02352e9dfbc6adb19a718662e3c5a
6
+ metadata.gz: aa95ff0d4625718abc856567dcee41527b265af2c0997ed81e8e0123194354ea55b929dc3597c57d409df503b01e1b97386eafe22ee0c8f7959128c180014dc2
7
+ data.tar.gz: a3e789046eee8ecded681dfaef3285c7c1dae8fed1cb65df60c7a2f9392d8ec4e824bca112a96955706763a4f0fb4e43b941ef59740058cc3b2a3eef83f2724c
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-darwin
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