nokolexbor 0.4.2-x86_64-linux → 0.5.2-x86_64-linux

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: 4757c637b238fbcfb5f3e45c2a8aba8b7198bed4f23b0657fbc21f589f506b47
4
- data.tar.gz: 02bee409f55fc5fbcd094f138d1a3d0a03756d2ab6617d8c1603995d0e9af2a3
3
+ metadata.gz: 2766d30a63be39414b5cb4cc548a9939cd7b4945a8400ef796f28b1ba97f6c30
4
+ data.tar.gz: 2b5a6720dbc645140964fc98b9a095743565244942c012dbee54ccb0779a362c
5
5
  SHA512:
6
- metadata.gz: 12bb1169c0b467d42c32f464e907221d2a245cb1503dc4f8dcacaba96bdf924e09829e2930f8627a4d565acf812a6932bcff0d908903c49da296f0b235613798
7
- data.tar.gz: a857ccb983a26fd0d09a5e5692d385ef61de21fb5d24bab90c81b5f3a43a6f7b769b7a1867c077664e95587d863c189544765ea9001619e1e7238a56e9d9c9b1
6
+ metadata.gz: bc80592ff4fb62092a2ab4034cbced35a773ee2feb053f9704932e92541458ae34a1fba32ae07ff78329e2a0e10ffe1ffda739c94477415cbef5b8956bcd59ec
7
+ data.tar.gz: 10ba68c497f24e3876f5626e2c35410cebc67d556700dbf9720ecffb9ea2b24b99217e57a3e7647f764e0bc972e4cee35a5850a44adf25c2bdd00532d17a404a
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-linux
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