node_query 1.9.0 → 1.10.0

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: ac9505065daaa42db8776813e028b75fb79ba48a72482bf35eb9cc5d79ac8994
4
- data.tar.gz: 5d844d6c156a48c1412f66268cfd7c5c33f59a06c4f168a3bba323a06ec28ff6
3
+ metadata.gz: cc14f10f4a27631913cd6d9b3b66b100864778756bc317b1529abe45999255b4
4
+ data.tar.gz: 2e04f47d2bbc0eade7ea2a047fe27174ec0e343d875203a0d3cd39fcaea50120
5
5
  SHA512:
6
- metadata.gz: d08239f6b06b6ee91b8d0de6bb446c85134bab339b7d1b2a02c42030c8ca5d4fba18e4fffd8753b178b60e27f8adcefc759fb61b8f525b81d1cf6926082e0c23
7
- data.tar.gz: e3526ce4933636ba5dca462df668a66f5e9fc92c63bb92a2ef655a9fa16d598997ae1aa7e9eb036d3896b08cf363a04ad3ea296bf7935708228eefa3731ce3c3
6
+ metadata.gz: 4b434f39629e544435594f4d299b845841b4610bed644954b0e835a7eed7d1b178d510d2ba5be8bfea0d3365d15f46d73a64ea8e9310037f4a851fa9989d05f3
7
+ data.tar.gz: bee545aae91e3769cb616e156f4cf6a69f628f5cc3a9e25432ea7eb9224a8ea49f1f76518b09601ce692b52790e5f0fd5da518d55650a243c0478d9056ac9a53
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.10.0 (2022-10-26)
4
+
5
+ * Add `NodeQuery::MethodNotSupported` error
6
+ * Add `NodeQuery::AnyValue` to match any value in node rules
7
+
3
8
  ## 1.9.0 (2022-10-23)
4
9
 
5
10
  * Support `NOT INCLUDES` operator
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- node_query (1.9.0)
4
+ node_query (1.10.0)
5
5
  activesupport (< 7.0.0)
6
6
 
7
7
  GEM
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A new type to match any value.
4
+ class NodeQuery::AnyValue
5
+ end
@@ -88,7 +88,7 @@ class NodeQuery::NodeRules
88
88
  # @param actual [Object] actual value.
89
89
  # @param expected [Object] expected value.
90
90
  # @return [Boolean]
91
- # @raise [Synvert::Core::MethodNotSupported] if expected class is not supported.
91
+ # @raise [NodeQuery::MethodNotSupported] if expected class is not supported.
92
92
  def match_value?(actual, expected)
93
93
  return true if actual == expected
94
94
 
@@ -136,10 +136,10 @@ class NodeQuery::NodeRules
136
136
  :false == actual.type
137
137
  when Parser::AST::Node
138
138
  actual == expected
139
- when Synvert::Core::Rewriter::AnyValue
139
+ when NodeQuery::AnyValue
140
140
  !actual.nil?
141
141
  else
142
- raise Synvert::Core::MethodNotSupported, "#{expected.class} is not handled for match_value?"
142
+ raise NodeQuery::MethodNotSupported, "#{expected} is not supported"
143
143
  end
144
144
  end
145
145
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class NodeQuery
4
- VERSION = "1.9.0"
4
+ VERSION = "1.10.0"
5
5
  end
data/lib/node_query.rb CHANGED
@@ -7,11 +7,14 @@ require_relative "./node_query_lexer.rex"
7
7
  require_relative "./node_query_parser.racc"
8
8
 
9
9
  class NodeQuery
10
+ class MethodNotSupported < StandardError; end
11
+
10
12
  autoload :Adapter, "node_query/adapter"
11
13
  autoload :ParserAdapter, "node_query/parser_adapter"
12
14
  autoload :Compiler, "node_query/compiler"
13
15
  autoload :Helper, "node_query/helper"
14
16
  autoload :NodeRules, "node_query/node_rules"
17
+ autoload :AnyValue, 'node_query/any_value'
15
18
 
16
19
  # Configure NodeQuery
17
20
  # @param [Hash] options options to configure
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: node_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-23 00:00:00.000000000 Z
11
+ date: 2022-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -40,6 +40,7 @@ files:
40
40
  - Rakefile
41
41
  - lib/node_query.rb
42
42
  - lib/node_query/adapter.rb
43
+ - lib/node_query/any_value.rb
43
44
  - lib/node_query/compiler.rb
44
45
  - lib/node_query/compiler/array_value.rb
45
46
  - lib/node_query/compiler/attribute.rb