rubocop-ast 1.6.0 → 1.7.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: c1f86e6a6bcb200cfd73b5bf9d959584812252f6cc365b115e1448daae6f1430
4
- data.tar.gz: 5c40556b0692122859f39f0dbe2d9dbf5fea1aeaed67b654828b815dd3ea85f1
3
+ metadata.gz: 25e84f96e233a9c966ad15efd834e109fea1c11d0998e2913ffd81310568d2b2
4
+ data.tar.gz: f6b8a033d2fd90518fb102f2cfaa27a5ef32bcfb892783ef79e2b9ad33ab4235
5
5
  SHA512:
6
- metadata.gz: 40ced8eab14849512c8d5c4096716a27786d95a5e1d14b300c5f1b52fd009e685e93fa472b842beaa67e9141e21465ef155ae2876d7020566a61da23855a57af
7
- data.tar.gz: 259e988322fa736908819654e29ecdafe791db5336b06a790ca268b8a73f7031fd262560508743a137dd3ba996405c92ad7d97354c630182e82f9c3d1e0baf43
6
+ metadata.gz: 326d28041a4c30d64cac801ceec9677eea264c7a98754217ae27b026bf9779122803402cdddd8306881320e8ac185ce3ff708d4b6e2c869840622303b50b9ab1
7
+ data.tar.gz: 293b516ba03824c5c9fc56557943993688cf0796bd7ffe567434f7633ca71aa24aec8ebcac89284c3b7b9fb7d38302cf666b1e7b0bb844700d70bad8c65cc767
@@ -6,6 +6,13 @@ module RuboCop
6
6
  # node when the builder constructs the AST, making its methods available
7
7
  # to all `in` nodes within RuboCop.
8
8
  class InPatternNode < Node
9
+ # Returns a node of the pattern in the `in` branch.
10
+ #
11
+ # @return [Node] a pattern node
12
+ def pattern
13
+ node_parts.first
14
+ end
15
+
9
16
  # Returns the index of the `in` branch within the `case` statement.
10
17
  #
11
18
  # @return [Integer] the index of the `in` branch
@@ -165,16 +165,34 @@ module RuboCop
165
165
  ARITHMETIC_OPERATORS.include?(method_name)
166
166
  end
167
167
 
168
- # Checks if this node is part of a chain of `def` modifiers.
168
+ # Checks if this node is part of a chain of `def` or `defs` modifiers.
169
169
  #
170
170
  # @example
171
171
  #
172
172
  # private def foo; end
173
173
  #
174
- # @return [Boolean] whether the dispatched method is a `def` modifier
175
- def def_modifier?
176
- send_type? &&
177
- adjacent_def_modifier? || each_child_node(:send).any?(&:def_modifier?)
174
+ # @return wether the `def|defs` node is a modifier or not.
175
+ # See also `def_modifier` that returns the node or `nil`
176
+ def def_modifier?(node = self)
177
+ !!def_modifier(node)
178
+ end
179
+
180
+ # Checks if this node is part of a chain of `def` or `defs` modifiers.
181
+ #
182
+ # @example
183
+ #
184
+ # private def foo; end
185
+ #
186
+ # @return [Node | nil] returns the `def|defs` node this is a modifier for,
187
+ # or `nil` if it isn't a def modifier
188
+ def def_modifier(node = self)
189
+ arg = node.children[2]
190
+
191
+ return unless node.send_type? && node.receiver.nil? && arg.is_a?(::AST::Node)
192
+
193
+ return arg if arg.def_type? || arg.defs_type?
194
+
195
+ def_modifier(arg)
178
196
  end
179
197
 
180
198
  # Checks whether this is a lambda. Some versions of parser parses
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  # DO NOT MODIFY!!!!
4
- # This file is automatically generated by Racc 1.5.2
4
+ # This file is automatically generated by Racc 1.5.1
5
5
  # from Racc grammar file "".
6
6
  #
7
7
 
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module AST
5
5
  module Version
6
- STRING = '1.6.0'
6
+ STRING = '1.7.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
8
8
  - Jonas Arvidsson
9
9
  - Yuji Nakayama
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-05-26 00:00:00.000000000 Z
13
+ date: 2021-05-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parser
@@ -154,7 +154,7 @@ metadata:
154
154
  source_code_uri: https://github.com/rubocop-hq/rubocop-ast/
155
155
  documentation_uri: https://docs.rubocop.org/rubocop-ast/
156
156
  bug_tracker_uri: https://github.com/rubocop-hq/rubocop-ast/issues
157
- post_install_message:
157
+ post_install_message:
158
158
  rdoc_options: []
159
159
  require_paths:
160
160
  - lib
@@ -169,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.1.2
173
- signing_key:
172
+ rubygems_version: 3.2.3
173
+ signing_key:
174
174
  specification_version: 4
175
175
  summary: RuboCop tools to deal with Ruby code AST.
176
176
  test_files: []