rubocop-ast 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1f86e6a6bcb200cfd73b5bf9d959584812252f6cc365b115e1448daae6f1430
|
4
|
+
data.tar.gz: 5c40556b0692122859f39f0dbe2d9dbf5fea1aeaed67b654828b815dd3ea85f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40ced8eab14849512c8d5c4096716a27786d95a5e1d14b300c5f1b52fd009e685e93fa472b842beaa67e9141e21465ef155ae2876d7020566a61da23855a57af
|
7
|
+
data.tar.gz: 259e988322fa736908819654e29ecdafe791db5336b06a790ca268b8a73f7031fd262560508743a137dd3ba996405c92ad7d97354c630182e82f9c3d1e0baf43
|
data/lib/rubocop/ast.rb
CHANGED
@@ -53,6 +53,7 @@ require_relative 'ast/node/forward_args_node'
|
|
53
53
|
require_relative 'ast/node/float_node'
|
54
54
|
require_relative 'ast/node/hash_node'
|
55
55
|
require_relative 'ast/node/if_node'
|
56
|
+
require_relative 'ast/node/in_pattern_node'
|
56
57
|
require_relative 'ast/node/index_node'
|
57
58
|
require_relative 'ast/node/indexasgn_node'
|
58
59
|
require_relative 'ast/node/int_node'
|
data/lib/rubocop/ast/builder.rb
CHANGED
@@ -24,9 +24,9 @@ module RuboCop
|
|
24
24
|
self
|
25
25
|
end
|
26
26
|
|
27
|
-
# Returns an array of all the
|
27
|
+
# Returns an array of all the `in` pattern branches in the `case` statement.
|
28
28
|
#
|
29
|
-
# @return [Array<
|
29
|
+
# @return [Array<InPatternNode>] an array of `in_pattern` nodes
|
30
30
|
def in_pattern_branches
|
31
31
|
node_parts[1...-1]
|
32
32
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module AST
|
5
|
+
# A node extension for `in` nodes. This will be used in place of a plain
|
6
|
+
# node when the builder constructs the AST, making its methods available
|
7
|
+
# to all `in` nodes within RuboCop.
|
8
|
+
class InPatternNode < Node
|
9
|
+
# Returns the index of the `in` branch within the `case` statement.
|
10
|
+
#
|
11
|
+
# @return [Integer] the index of the `in` branch
|
12
|
+
def branch_index
|
13
|
+
parent.in_pattern_branches.index(self)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Checks whether the `in` node has a `then` keyword.
|
17
|
+
#
|
18
|
+
# @return [Boolean] whether the `in` node has a `then` keyword
|
19
|
+
def then?
|
20
|
+
loc.begin&.is?('then')
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns the body of the `in` node.
|
24
|
+
#
|
25
|
+
# @return [Node, nil] the body of the `in` node
|
26
|
+
def body
|
27
|
+
node_parts[-1]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/rubocop/ast/version.rb
CHANGED
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.
|
4
|
+
version: 1.6.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-
|
13
|
+
date: 2021-05-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/rubocop/ast/node/forward_args_node.rb
|
83
83
|
- lib/rubocop/ast/node/hash_node.rb
|
84
84
|
- lib/rubocop/ast/node/if_node.rb
|
85
|
+
- lib/rubocop/ast/node/in_pattern_node.rb
|
85
86
|
- lib/rubocop/ast/node/index_node.rb
|
86
87
|
- lib/rubocop/ast/node/indexasgn_node.rb
|
87
88
|
- lib/rubocop/ast/node/int_node.rb
|
@@ -153,7 +154,7 @@ metadata:
|
|
153
154
|
source_code_uri: https://github.com/rubocop-hq/rubocop-ast/
|
154
155
|
documentation_uri: https://docs.rubocop.org/rubocop-ast/
|
155
156
|
bug_tracker_uri: https://github.com/rubocop-hq/rubocop-ast/issues
|
156
|
-
post_install_message:
|
157
|
+
post_install_message:
|
157
158
|
rdoc_options: []
|
158
159
|
require_paths:
|
159
160
|
- lib
|
@@ -168,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
169
|
- !ruby/object:Gem::Version
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
|
-
rubygems_version: 3.2
|
172
|
-
signing_key:
|
172
|
+
rubygems_version: 3.1.2
|
173
|
+
signing_key:
|
173
174
|
specification_version: 4
|
174
175
|
summary: RuboCop tools to deal with Ruby code AST.
|
175
176
|
test_files: []
|