nokolexbor 0.4.1-arm64-darwin → 0.5.0-arm64-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: cb6e20ad856d92b6c723db208bcde282248c8946bced0e3f839db3c51a6988cb
4
- data.tar.gz: c14213418ed1ead043c06c725ed518a22dcc578605ab3249beb9e0a594c035bc
3
+ metadata.gz: d282da737e7723d412d2ae08a086817be69ef089750ff60d22566d4f05d29c1a
4
+ data.tar.gz: 7147d490f8981b3df1589a6e684d64992bf2f56a700f6be9daa46151c17dadf1
5
5
  SHA512:
6
- metadata.gz: b0378105c1e187e64ad08788b78c4d0717af6ad567358727a10def7a59b2d30fd4e24578fb724652315bed849acfd585311e2e308d0e64dc7d73619a37beda0b
7
- data.tar.gz: 04df173679784b4e06980b705547b15cddce1386924f5e10b08e533a09600c47c29c5bf1b0c2c85337db8015133393e7657545668621674754c46e5c0dfbca93
6
+ metadata.gz: 44b2a326920631442de1ad70aca11b3ffc3a95f33671a831a74843a266528acabbb6735d66323704f69680c728cc98c7d83d2e1709a74ced55b8ff5b687051d3
7
+ data.tar.gz: 12fa39b5c9632055c2b81c013cc508659ae30a0a66badca2ebf62f7b7b43ccfb773fd2269fcbbd116b7adcc17851456728256053191a36d13cc20bec9d6381ef
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: arm64-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