sorbet-schema 0.3.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/Gemfile.lock +17 -17
  4. data/lib/sorbet-schema/hash_transformer.rb +27 -2
  5. data/lib/sorbet-schema/version.rb +1 -1
  6. data/lib/typed/coercion/boolean_coercer.rb +31 -0
  7. data/lib/typed/coercion/coercer.rb +3 -3
  8. data/lib/typed/coercion/coercer_registry.rb +14 -2
  9. data/lib/typed/coercion/date_coercer.rb +29 -0
  10. data/lib/typed/coercion/enum_coercer.rb +27 -0
  11. data/lib/typed/coercion/float_coercer.rb +6 -4
  12. data/lib/typed/coercion/integer_coercer.rb +6 -4
  13. data/lib/typed/coercion/string_coercer.rb +6 -4
  14. data/lib/typed/coercion/struct_coercer.rb +12 -10
  15. data/lib/typed/coercion/typed_array_coercer.rb +34 -0
  16. data/lib/typed/coercion.rb +4 -4
  17. data/lib/typed/deserialize_error.rb +1 -1
  18. data/lib/typed/field.rb +49 -5
  19. data/lib/typed/hash_serializer.rb +18 -6
  20. data/lib/typed/json_serializer.rb +4 -2
  21. data/lib/typed/schema.rb +10 -0
  22. data/lib/typed/serialization_error.rb +17 -0
  23. data/lib/typed/serialize_error.rb +6 -0
  24. data/lib/typed/serializer.rb +12 -7
  25. data/lib/typed/validations/field_type_validator.rb +1 -1
  26. data/lib/typed/validations/type_mismatch_error.rb +1 -1
  27. data/sorbet/rbi/gems/{minitest@5.22.2.rbi → minitest@5.22.3.rbi} +19 -18
  28. data/sorbet/rbi/gems/{rubocop-ast@1.31.1.rbi → rubocop-ast@1.31.2.rbi} +70 -70
  29. data/sorbet/rbi/gems/{rubocop@1.61.0.rbi → rubocop@1.62.1.rbi} +276 -233
  30. data/sorbet/rbi/gems/{standard@1.34.0.rbi → standard@1.35.1.rbi} +56 -56
  31. metadata +13 -7
  32. /data/sorbet/rbi/gems/{rubocop-sorbet@0.7.7.rbi → rubocop-sorbet@0.7.8.rbi} +0 -0
@@ -20,11 +20,11 @@ module Typed
20
20
  @schema = schema
21
21
  end
22
22
 
23
- sig { abstract.params(source: Output).returns(DeserializeResult) }
23
+ sig { abstract.params(source: Input).returns(DeserializeResult) }
24
24
  def deserialize(source)
25
25
  end
26
26
 
27
- sig { abstract.params(struct: T::Struct).returns(Output) }
27
+ sig { abstract.params(struct: T::Struct).returns(Result[Output, SerializeError]) }
28
28
  def serialize(struct)
29
29
  end
30
30
 
@@ -35,18 +35,16 @@ module Typed
35
35
  results = schema.fields.map do |field|
36
36
  value = creation_params[field.name]
37
37
 
38
- if value.nil?
38
+ if value.nil? || field.works_with?(value)
39
39
  field.validate(value)
40
- elsif value.class != field.type
41
- coercion_result = Coercion.coerce(field: field, value: value)
40
+ else
41
+ coercion_result = Coercion.coerce(type: field.type, value: value)
42
42
 
43
43
  if coercion_result.success?
44
44
  field.validate(coercion_result.payload)
45
45
  else
46
46
  Failure.new(Validations::ValidationError.new(coercion_result.error.message))
47
47
  end
48
- else
49
- field.validate(value)
50
48
  end
51
49
  end
52
50
 
@@ -57,5 +55,12 @@ module Typed
57
55
  Success.new(schema.target.new(**validated_params))
58
56
  end
59
57
  end
58
+
59
+ sig { params(struct: T::Struct, should_serialize_values: T::Boolean).returns(T::Hash[Symbol, T.untyped]) }
60
+ def serialize_from_struct(struct:, should_serialize_values: false)
61
+ hsh = schema.fields.each_with_object({}) { |field, hsh| hsh[field.name] = field.serialize(struct.send(field.name)) }.compact
62
+
63
+ HashTransformer.new(should_serialize_values: should_serialize_values).deep_symbolize_keys(hsh)
64
+ end
60
65
  end
61
66
  end
@@ -9,7 +9,7 @@ module Typed
9
9
 
10
10
  sig { override.params(field: Field, value: Value).returns(ValidationResult) }
11
11
  def validate(field:, value:)
12
- if field.type == value.class
12
+ if field.works_with?(value)
13
13
  Success.new(ValidatedValue.new(name: field.name, value: value))
14
14
  elsif field.required? && value.nil?
15
15
  Failure.new(RequiredFieldError.new(field_name: field.name))
@@ -5,7 +5,7 @@ module Typed
5
5
  class TypeMismatchError < ValidationError
6
6
  extend T::Sig
7
7
 
8
- sig { params(field_name: Symbol, field_type: T::Class[T.anything], given_type: T::Class[T.anything]).void }
8
+ sig { params(field_name: Symbol, field_type: T::Types::Base, given_type: T::Class[T.anything]).void }
9
9
  def initialize(field_name:, field_type:, given_type:)
10
10
  super("Invalid type given to #{field_name}. Expected #{field_type}, got #{given_type}.")
11
11
  end
@@ -1988,27 +1988,27 @@ class Minitest::Test < ::Minitest::Runnable
1988
1988
 
1989
1989
  # LifecycleHooks
1990
1990
  #
1991
- # source://minitest//lib/minitest/test.rb#190
1991
+ # source://minitest//lib/minitest/test.rb#191
1992
1992
  def capture_exceptions; end
1993
1993
 
1994
1994
  # source://minitest//lib/minitest/test.rb#15
1995
1995
  def class_name; end
1996
1996
 
1997
- # source://minitest//lib/minitest/test.rb#207
1997
+ # source://minitest//lib/minitest/test.rb#208
1998
1998
  def neuter_exception(e); end
1999
1999
 
2000
- # source://minitest//lib/minitest/test.rb#218
2000
+ # source://minitest//lib/minitest/test.rb#219
2001
2001
  def new_exception(klass, msg, bt, kill = T.unsafe(nil)); end
2002
2002
 
2003
2003
  # Runs a single test with setup/teardown hooks.
2004
2004
  #
2005
- # source://minitest//lib/minitest/test.rb#86
2005
+ # source://minitest//lib/minitest/test.rb#87
2006
2006
  def run; end
2007
2007
 
2008
- # source://minitest//lib/minitest/test.rb#200
2008
+ # source://minitest//lib/minitest/test.rb#201
2009
2009
  def sanitize_exception(e); end
2010
2010
 
2011
- # source://minitest//lib/minitest/test.rb#232
2011
+ # source://minitest//lib/minitest/test.rb#233
2012
2012
  def with_info_handler(&block); end
2013
2013
 
2014
2014
  class << self
@@ -2048,18 +2048,19 @@ class Minitest::Test < ::Minitest::Runnable
2048
2048
  # source://minitest//lib/minitest/test.rb#48
2049
2049
  def make_my_diffs_pretty!; end
2050
2050
 
2051
- # Call this at the top of your tests when you want to run your
2052
- # tests in parallel. In doing so, you're admitting that you rule
2053
- # and your tests are awesome.
2051
+ # Call this at the top of your tests (inside the +Minitest::Test+
2052
+ # subclass or +describe+ block) when you want to run your tests in
2053
+ # parallel. In doing so, you're admitting that you rule and your
2054
+ # tests are awesome.
2054
2055
  #
2055
- # source://minitest//lib/minitest/test.rb#59
2056
+ # source://minitest//lib/minitest/test.rb#60
2056
2057
  def parallelize_me!; end
2057
2058
 
2058
2059
  # Returns all instance methods starting with "test_". Based on
2059
2060
  # #test_order, the methods are either sorted, randomized
2060
2061
  # (default), or run in parallel.
2061
2062
  #
2062
- # source://minitest//lib/minitest/test.rb#69
2063
+ # source://minitest//lib/minitest/test.rb#70
2063
2064
  def runnable_methods; end
2064
2065
 
2065
2066
  # source://minitest-focus/1.4.0/lib/minitest/focus.rb#52
@@ -2071,7 +2072,7 @@ end
2071
2072
  # meant for library writers, NOT for regular test authors. See
2072
2073
  # #before_setup for an example.
2073
2074
  #
2074
- # source://minitest//lib/minitest/test.rb#113
2075
+ # source://minitest//lib/minitest/test.rb#114
2075
2076
  module Minitest::Test::LifecycleHooks
2076
2077
  # Runs before every test, after setup. This hook is meant for
2077
2078
  # libraries to extend minitest. It is not meant to be used by
@@ -2079,7 +2080,7 @@ module Minitest::Test::LifecycleHooks
2079
2080
  #
2080
2081
  # See #before_setup for an example.
2081
2082
  #
2082
- # source://minitest//lib/minitest/test.rb#163
2083
+ # source://minitest//lib/minitest/test.rb#164
2083
2084
  def after_setup; end
2084
2085
 
2085
2086
  # Runs after every test, after teardown. This hook is meant for
@@ -2088,7 +2089,7 @@ module Minitest::Test::LifecycleHooks
2088
2089
  #
2089
2090
  # See #before_setup for an example.
2090
2091
  #
2091
- # source://minitest//lib/minitest/test.rb#187
2092
+ # source://minitest//lib/minitest/test.rb#188
2092
2093
  def after_teardown; end
2093
2094
 
2094
2095
  # Runs before every test, before setup. This hook is meant for
@@ -2123,7 +2124,7 @@ module Minitest::Test::LifecycleHooks
2123
2124
  # include MyMinitestPlugin
2124
2125
  # end
2125
2126
  #
2126
- # source://minitest//lib/minitest/test.rb#148
2127
+ # source://minitest//lib/minitest/test.rb#149
2127
2128
  def before_setup; end
2128
2129
 
2129
2130
  # Runs after every test, before teardown. This hook is meant for
@@ -2132,19 +2133,19 @@ module Minitest::Test::LifecycleHooks
2132
2133
  #
2133
2134
  # See #before_setup for an example.
2134
2135
  #
2135
- # source://minitest//lib/minitest/test.rb#172
2136
+ # source://minitest//lib/minitest/test.rb#173
2136
2137
  def before_teardown; end
2137
2138
 
2138
2139
  # Runs before every test. Use this to set up before each test
2139
2140
  # run.
2140
2141
  #
2141
- # source://minitest//lib/minitest/test.rb#154
2142
+ # source://minitest//lib/minitest/test.rb#155
2142
2143
  def setup; end
2143
2144
 
2144
2145
  # Runs after every test. Use this to clean up after each test
2145
2146
  # run.
2146
2147
  #
2147
- # source://minitest//lib/minitest/test.rb#178
2148
+ # source://minitest//lib/minitest/test.rb#179
2148
2149
  def teardown; end
2149
2150
  end
2150
2151
 
@@ -4841,116 +4841,116 @@ class RuboCop::AST::NodePattern::Parser < ::Racc::Parser
4841
4841
  # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.rb#19
4842
4842
  def initialize(builder = T.unsafe(nil)); end
4843
4843
 
4844
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#333
4844
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#335
4845
4845
  def _reduce_10(val, _values); end
4846
4846
 
4847
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#337
4847
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#339
4848
4848
  def _reduce_11(val, _values); end
4849
4849
 
4850
4850
  # reduce 12 omitted
4851
4851
  #
4852
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#343
4852
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#345
4853
4853
  def _reduce_13(val, _values); end
4854
4854
 
4855
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#347
4855
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#349
4856
4856
  def _reduce_14(val, _values); end
4857
4857
 
4858
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#351
4858
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#353
4859
4859
  def _reduce_15(val, _values); end
4860
4860
 
4861
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#355
4861
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#357
4862
4862
  def _reduce_16(val, _values); end
4863
4863
 
4864
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#359
4864
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#361
4865
4865
  def _reduce_17(val, _values); end
4866
4866
 
4867
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#363
4867
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#365
4868
4868
  def _reduce_18(val, _values); end
4869
4869
 
4870
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#367
4870
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#369
4871
4871
  def _reduce_19(val, _values); end
4872
4872
 
4873
4873
  # reduce 1 omitted
4874
4874
  #
4875
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#301
4875
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#303
4876
4876
  def _reduce_2(val, _values); end
4877
4877
 
4878
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#371
4878
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#373
4879
4879
  def _reduce_20(val, _values); end
4880
4880
 
4881
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#375
4881
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#377
4882
4882
  def _reduce_21(val, _values); end
4883
4883
 
4884
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#379
4884
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#381
4885
4885
  def _reduce_22(val, _values); end
4886
4886
 
4887
4887
  # reduce 24 omitted
4888
4888
  #
4889
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#387
4889
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#389
4890
4890
  def _reduce_25(val, _values); end
4891
4891
 
4892
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#393
4892
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#395
4893
4893
  def _reduce_26(val, _values); end
4894
4894
 
4895
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#305
4895
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#307
4896
4896
  def _reduce_3(val, _values); end
4897
4897
 
4898
4898
  # reduce 32 omitted
4899
4899
  #
4900
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#413
4900
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#415
4901
4901
  def _reduce_33(val, _values); end
4902
4902
 
4903
4903
  # reduce 36 omitted
4904
4904
  #
4905
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#423
4905
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#425
4906
4906
  def _reduce_37(val, _values); end
4907
4907
 
4908
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#427
4908
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#429
4909
4909
  def _reduce_38(val, _values); end
4910
4910
 
4911
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#431
4911
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#433
4912
4912
  def _reduce_39(val, _values); end
4913
4913
 
4914
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#309
4914
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#311
4915
4915
  def _reduce_4(val, _values); end
4916
4916
 
4917
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#435
4917
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#437
4918
4918
  def _reduce_40(val, _values); end
4919
4919
 
4920
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#439
4920
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#441
4921
4921
  def _reduce_41(val, _values); end
4922
4922
 
4923
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#443
4923
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#445
4924
4924
  def _reduce_42(val, _values); end
4925
4925
 
4926
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#447
4926
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#449
4927
4927
  def _reduce_43(val, _values); end
4928
4928
 
4929
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#451
4929
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#453
4930
4930
  def _reduce_44(val, _values); end
4931
4931
 
4932
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#455
4932
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#457
4933
4933
  def _reduce_45(val, _values); end
4934
4934
 
4935
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#459
4935
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#461
4936
4936
  def _reduce_46(val, _values); end
4937
4937
 
4938
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#313
4938
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#315
4939
4939
  def _reduce_5(val, _values); end
4940
4940
 
4941
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#317
4941
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#319
4942
4942
  def _reduce_6(val, _values); end
4943
4943
 
4944
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#321
4944
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#323
4945
4945
  def _reduce_7(val, _values); end
4946
4946
 
4947
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#325
4947
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#327
4948
4948
  def _reduce_8(val, _values); end
4949
4949
 
4950
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#329
4950
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#331
4951
4951
  def _reduce_9(val, _values); end
4952
4952
 
4953
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#463
4953
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#465
4954
4954
  def _reduce_none(val, _values); end
4955
4955
 
4956
4956
  # source://forwardable/1.3.3/forwardable.rb#231
@@ -5010,10 +5010,10 @@ RuboCop::AST::NodePattern::Parser::Lexer = RuboCop::AST::NodePattern::Lexer
5010
5010
  # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#227
5011
5011
  RuboCop::AST::NodePattern::Parser::Racc_arg = T.let(T.unsafe(nil), Array)
5012
5012
 
5013
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#293
5013
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#295
5014
5014
  RuboCop::AST::NodePattern::Parser::Racc_debug_parser = T.let(T.unsafe(nil), FalseClass)
5015
5015
 
5016
- # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#243
5016
+ # source://rubocop-ast//lib/rubocop/ast/node_pattern/parser.racc.rb#244
5017
5017
  RuboCop::AST::NodePattern::Parser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array)
5018
5018
 
5019
5019
  # Overrides Parser to use `WithMeta` variants and provide additional methods
@@ -5745,7 +5745,7 @@ class RuboCop::AST::ProcessedSource
5745
5745
  # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#29
5746
5746
  def initialize(source, ruby_version, path = T.unsafe(nil), parser_engine: T.unsafe(nil)); end
5747
5747
 
5748
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#72
5748
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#73
5749
5749
  def [](*args); end
5750
5750
 
5751
5751
  # Returns the value of attribute ast.
@@ -5753,12 +5753,12 @@ class RuboCop::AST::ProcessedSource
5753
5753
  # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#21
5754
5754
  def ast; end
5755
5755
 
5756
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#50
5756
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#51
5757
5757
  def ast_with_comments; end
5758
5758
 
5759
5759
  # @return [Boolean]
5760
5760
  #
5761
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#111
5761
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#112
5762
5762
  def blank?; end
5763
5763
 
5764
5764
  # Returns the value of attribute buffer.
@@ -5768,12 +5768,12 @@ class RuboCop::AST::ProcessedSource
5768
5768
 
5769
5769
  # Raw source checksum for tracking infinite loops.
5770
5770
  #
5771
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#83
5771
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#84
5772
5772
  def checksum; end
5773
5773
 
5774
5774
  # @return [Comment, nil] the comment at that line, if any.
5775
5775
  #
5776
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#116
5776
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#117
5777
5777
  def comment_at_line(line); end
5778
5778
 
5779
5779
  # Consider using `each_comment_in_lines` instead
@@ -5781,7 +5781,7 @@ class RuboCop::AST::ProcessedSource
5781
5781
  # @deprecated use contains_comment?
5782
5782
  # @return [Boolean] if any of the lines in the given `source_range` has a comment.
5783
5783
  #
5784
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#138
5784
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#139
5785
5785
  def commented?(source_range); end
5786
5786
 
5787
5787
  # Returns the value of attribute comments.
@@ -5793,17 +5793,17 @@ class RuboCop::AST::ProcessedSource
5793
5793
  #
5794
5794
  # @deprecated Use `each_comment_in_lines`
5795
5795
  #
5796
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#146
5796
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#147
5797
5797
  def comments_before_line(line); end
5798
5798
 
5799
5799
  # Consider using `each_comment_in_lines` instead
5800
5800
  #
5801
5801
  # @return [Boolean] if any of the lines in the given `source_range` has a comment.
5802
5802
  #
5803
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#138
5803
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#139
5804
5804
  def contains_comment?(source_range); end
5805
5805
 
5806
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#160
5806
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#161
5807
5807
  def current_line(token); end
5808
5808
 
5809
5809
  # Returns the value of attribute diagnostics.
@@ -5813,53 +5813,53 @@ class RuboCop::AST::ProcessedSource
5813
5813
 
5814
5814
  # @deprecated Use `comments.each`
5815
5815
  #
5816
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#88
5816
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#89
5817
5817
  def each_comment(&block); end
5818
5818
 
5819
5819
  # Enumerates on the comments contained with the given `line_range`
5820
5820
  #
5821
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#126
5821
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#127
5822
5822
  def each_comment_in_lines(line_range); end
5823
5823
 
5824
5824
  # @deprecated Use `tokens.each`
5825
5825
  #
5826
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#98
5826
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#99
5827
5827
  def each_token(&block); end
5828
5828
 
5829
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#107
5829
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#108
5830
5830
  def file_path; end
5831
5831
 
5832
5832
  # @deprecated Use `comment_at_line`, `each_comment_in_lines`, or `comments.find`
5833
5833
  #
5834
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#93
5834
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#94
5835
5835
  def find_comment(&block); end
5836
5836
 
5837
5837
  # @deprecated Use `tokens.find`
5838
5838
  #
5839
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#103
5839
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#104
5840
5840
  def find_token(&block); end
5841
5841
 
5842
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#181
5842
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#182
5843
5843
  def first_token_of(range_or_node); end
5844
5844
 
5845
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#164
5845
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#165
5846
5846
  def following_line(token); end
5847
5847
 
5848
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#185
5848
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#186
5849
5849
  def last_token_of(range_or_node); end
5850
5850
 
5851
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#168
5851
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#169
5852
5852
  def line_indentation(line_number); end
5853
5853
 
5854
5854
  # @return [Boolean] if the given line number has a comment.
5855
5855
  #
5856
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#121
5856
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#122
5857
5857
  def line_with_comment?(line); end
5858
5858
 
5859
5859
  # Returns the source lines, line break characters removed, excluding a
5860
5860
  # possible __END__ and everything that comes after.
5861
5861
  #
5862
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#58
5862
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#59
5863
5863
  def lines; end
5864
5864
 
5865
5865
  # Returns the value of attribute parser_engine.
@@ -5877,7 +5877,7 @@ class RuboCop::AST::ProcessedSource
5877
5877
  # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#21
5878
5878
  def path; end
5879
5879
 
5880
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#156
5880
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#157
5881
5881
  def preceding_line(token); end
5882
5882
 
5883
5883
  # Returns the value of attribute raw_source.
@@ -5894,12 +5894,12 @@ class RuboCop::AST::ProcessedSource
5894
5894
  # is passed as a method argument. In this case tokens are interleaved by
5895
5895
  # heredoc contents' tokens.
5896
5896
  #
5897
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#192
5897
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#193
5898
5898
  def sorted_tokens; end
5899
5899
 
5900
5900
  # @return [Boolean]
5901
5901
  #
5902
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#150
5902
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#151
5903
5903
  def start_with?(string); end
5904
5904
 
5905
5905
  # Returns the value of attribute tokens.
@@ -5907,38 +5907,38 @@ class RuboCop::AST::ProcessedSource
5907
5907
  # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#21
5908
5908
  def tokens; end
5909
5909
 
5910
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#175
5910
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#176
5911
5911
  def tokens_within(range_or_node); end
5912
5912
 
5913
5913
  # @return [Boolean]
5914
5914
  #
5915
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#76
5915
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#77
5916
5916
  def valid_syntax?; end
5917
5917
 
5918
5918
  private
5919
5919
 
5920
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#199
5920
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#200
5921
5921
  def comment_index; end
5922
5922
 
5923
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#311
5923
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#312
5924
5924
  def create_parser(ruby_version, parser_engine); end
5925
5925
 
5926
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#327
5926
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#328
5927
5927
  def first_token_index(range_or_node); end
5928
5928
 
5929
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#332
5929
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#333
5930
5930
  def last_token_index(range_or_node); end
5931
5931
 
5932
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#205
5932
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#206
5933
5933
  def parse(source, ruby_version, parser_engine); end
5934
5934
 
5935
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#239
5935
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#240
5936
5936
  def parser_class(ruby_version, parser_engine); end
5937
5937
 
5938
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#337
5938
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#338
5939
5939
  def source_range(range_or_node); end
5940
5940
 
5941
- # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#222
5941
+ # source://rubocop-ast//lib/rubocop/ast/processed_source.rb#223
5942
5942
  def tokenize(parser); end
5943
5943
 
5944
5944
  class << self