nokolexbor 0.4.2-x86_64-darwin → 0.5.2-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: afd877eb3863f23063a19405686fde07a338f12e288730d05dd817a71f875f8b
4
- data.tar.gz: 25a316a358d8238ab34f2d71b9fb93b4bba7220bb29793916e083279529f7888
3
+ metadata.gz: 5bfa0d41d0790fa1f6ced9f127540430859aa437ea78f1f5a2b363ccb46b85c8
4
+ data.tar.gz: '08b635503b94352a768aad38f6c30e8f4c5c53372113592877872487125ed3b1'
5
5
  SHA512:
6
- metadata.gz: e5aee610a3a22308d2ee09d1cea372d9815c6c2e1d2bd99143b75e93987c589e00a7ee69d0861b7e4fb738e6d3bd3489de5d9fad6054481133632bfc5bbeeeb4
7
- data.tar.gz: f126a9850f17e2307d64098de46b1eee5bec44942c380987faf08acccb5f0ef40012dcdfb883a993663c73ec563985675f932c3b431f29bd343533de17a06012
6
+ metadata.gz: 8d79dc0c0b9ad23298c2c3482a3048298d275107d1a89e8538f763f2d67493d5fa5bea0e20e799917077b36ba09e2638d85afd57f422cadd1551d21580653f61
7
+ data.tar.gz: 790ba8ca12c6c99a1557fef2f54ea471510f261f53224dd95171db9828d119f6fe51d18c33e972cb5990106008511959cf30cd93cc5e5e18bb39f97834c2392b
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.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: 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-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