rubocop-ast 1.8.0 → 1.9.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: 9c8abd574665322b04af26974900562ce6224cdccb59fc1d8926971e39f0503f
4
- data.tar.gz: 87096e43215bc016c8afc66194a93dc22567960e3bfebfaa99468e8736e35b36
3
+ metadata.gz: e5f8cfde2fd4d1e7e8e61926e4bca24ca426274253cff583338688b38810ad8f
4
+ data.tar.gz: a9f1d7174de586df8f9004da23ce67738f43f2ffcc3309983be8cedb23960758
5
5
  SHA512:
6
- metadata.gz: 6a92317d5065b2b344c0130eaf37e77a410f4e0652cc30b9724ed44f0de05173213418bf9fd990b52de44e437547e90c0c6198f237c37ad8c8f99c9f4d0f2d9a
7
- data.tar.gz: 9a304655d736e46e9f2f8a2094e4f0ac5ed7bcd1aa0ad19b16ad954f3b4d170d965203b24552478505454ac1f38650a393c8a0aede4c9412c083259756bf9ea1
6
+ metadata.gz: baeed38e039ead920084a839a7e216b3567bad48ebe10aa4577c43e666f06cc9156cff4b47a7a9994a27f6a5c9cb4f08c0cd745bc28ce7468e434328e4389c53
7
+ data.tar.gz: 652edd75af0f4d8f4e30c19350a8a6e5cdd95e3fbdd0cd2247a7fb15bdea32fa337548411f75e68cc68445ea218fc9217ad83c442ec0a849c51ef6eb3b09edde
@@ -47,6 +47,7 @@ module RuboCop
47
47
  # Returns the else branch of the `case` statement, if any.
48
48
  #
49
49
  # @return [Node] the else branch node of the `case` statement
50
+ # @return [EmptyElse] the empty else branch node of the `case` statement
50
51
  # @return [nil] if the case statement does not have an else branch.
51
52
  def else_branch
52
53
  node_parts[-1]
@@ -80,23 +80,23 @@ module RuboCop
80
80
  "#<#{self.class} #{pattern}>"
81
81
  end
82
82
 
83
- def marshal_load(pattern) #:nodoc:
83
+ def marshal_load(pattern) # :nodoc:
84
84
  initialize pattern
85
85
  end
86
86
 
87
- def marshal_dump #:nodoc:
87
+ def marshal_dump # :nodoc:
88
88
  pattern
89
89
  end
90
90
 
91
- def as_json(_options = nil) #:nodoc:
91
+ def as_json(_options = nil) # :nodoc:
92
92
  pattern
93
93
  end
94
94
 
95
- def encode_with(coder) #:nodoc:
95
+ def encode_with(coder) # :nodoc:
96
96
  coder['pattern'] = pattern
97
97
  end
98
98
 
99
- def init_with(coder) #:nodoc:
99
+ def init_with(coder) # :nodoc:
100
100
  initialize(coder['pattern'])
101
101
  end
102
102
 
@@ -177,6 +177,14 @@ module RuboCop
177
177
  sorted_tokens[last_token_index(range_or_node)]
178
178
  end
179
179
 
180
+ # The tokens list is always sorted by token position, except for cases when heredoc
181
+ # is passed as a method argument. In this case tokens are interleaved by
182
+ # heredoc contents' tokens.
183
+ def sorted_tokens
184
+ # Use stable sort.
185
+ @sorted_tokens ||= tokens.sort_by.with_index { |token, i| [token.begin_pos, i] }
186
+ end
187
+
180
188
  private
181
189
 
182
190
  def comment_index
@@ -272,14 +280,6 @@ module RuboCop
272
280
  sorted_tokens.bsearch_index { |token| token.end_pos >= end_pos }
273
281
  end
274
282
 
275
- # The tokens list is always sorted by token position, except for cases when heredoc
276
- # is passed as a method argument. In this case tokens are interleaved by
277
- # heredoc contents' tokens.
278
- def sorted_tokens
279
- # Use stable sort.
280
- @sorted_tokens ||= tokens.sort_by.with_index { |token, i| [token.begin_pos, i] }
281
- end
282
-
283
283
  def source_range(range_or_node)
284
284
  if range_or_node.respond_to?(:source_range)
285
285
  range_or_node.source_range
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module AST
5
5
  module Version
6
- STRING = '1.8.0'
6
+ STRING = '1.9.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-07-14 00:00:00.000000000 Z
13
+ date: 2021-08-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parser