nokolexbor 0.4.2-x64-mingw-ucrt → 0.5.0-x64-mingw-ucrt

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: d35658daa78ce46c723a8dea5557f7b3efeddc097e6cce88d2b1d4c8371ef3c0
4
- data.tar.gz: 65b6a69ec504258da2e687a88088717373f603dfd889cb929ac0fcaf026b2a03
3
+ metadata.gz: 2e0b926c2277f378df1206598feb5d3a05df6595ac92f2e592283fa4f5787c8e
4
+ data.tar.gz: e77a5c194bf50142a5fbc33a903139d7920ddef52c1a921eebb6e66bf337cc39
5
5
  SHA512:
6
- metadata.gz: a1919a82d1f11ed08866e61ac5dfb223a5eff77a350d9544688c050b983a79894731f839c98e593587e9ce6b1b85ad4b9e60f7e23514a853bd368dd98126520e
7
- data.tar.gz: 85429ba89cd1be2c6e00d03559b65f555f4a0aa62a2da5af4e70544ae9408503d0be4a871ab74e801b9e2cd80e0c0f66231cd92440ba5073d8aa1e27a34a3409
6
+ metadata.gz: 63ae4c9bd3855cc541e8a8cb381b24e1a6aa67409d9cbe3cb76cf543ccefca7d8dac7e47cab1ed16e7be9f5258aa49aaf505d856262e5ef3132630159c1ca25e
7
+ data.tar.gz: '096914d05f665bdeb80150f06f9b65c2114a60c02cb4c78de306d1da9ca730b7b520f823f78d21e785a277082066fe192b0a5e792d7de73b951a8de41ae9c8c1'
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.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.2
4
+ version: 0.5.0
5
5
  platform: x64-mingw-ucrt
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-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler