rbs 3.7.0 → 3.8.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/ruby.yml +7 -7
- data/CHANGELOG.md +52 -0
- data/core/array.rbs +1743 -1580
- data/core/basic_object.rbs +38 -35
- data/core/comparable.rbs +1 -1
- data/core/complex.rbs +165 -93
- data/core/data.rbs +1 -1
- data/core/dir.rbs +1 -17
- data/core/encoding.rbs +12 -6
- data/core/enumerable.rbs +270 -266
- data/core/enumerator.rbs +0 -2
- data/core/env.rbs +1 -1
- data/core/errno.rbs +33 -16
- data/core/errors.rbs +2 -2
- data/core/exception.rbs +236 -170
- data/core/fiber.rbs +3 -2
- data/core/file.rbs +32 -74
- data/core/float.rbs +125 -72
- data/core/gc.rbs +138 -40
- data/core/hash.rbs +120 -141
- data/core/integer.rbs +79 -50
- data/core/io/buffer.rbs +49 -43
- data/core/io.rbs +97 -144
- data/core/kernel.rbs +290 -200
- data/core/match_data.rbs +76 -2
- data/core/math.rbs +0 -36
- data/core/module.rbs +28 -23
- data/core/nil_class.rbs +0 -3
- data/core/numeric.rbs +100 -103
- data/core/object.rbs +0 -4
- data/core/object_space/weak_key_map.rbs +3 -4
- data/core/object_space.rbs +3 -3
- data/core/proc.rbs +0 -2
- data/core/process.rbs +109 -57
- data/core/ractor.rbs +37 -4
- data/core/range.rbs +114 -87
- data/core/rational.rbs +0 -2
- data/core/rbs/unnamed/argf.rbs +234 -33
- data/core/rbs/unnamed/env_class.rbs +35 -53
- data/core/rbs/unnamed/random.rbs +1 -2
- data/core/regexp.rbs +4 -52
- data/core/ruby_vm.rbs +88 -9
- data/core/rubygems/config_file.rbs +3 -0
- data/core/rubygems/errors.rbs +0 -5
- data/core/rubygems/platform.rbs +0 -9
- data/core/rubygems/rubygems.rbs +0 -5
- data/core/rubygems/version.rbs +6 -6
- data/core/set.rbs +3 -15
- data/core/string.rbs +130 -136
- data/core/struct.rbs +6 -18
- data/core/symbol.rbs +14 -21
- data/core/thread.rbs +32 -35
- data/core/time.rbs +127 -50
- data/core/trace_point.rbs +16 -0
- data/core/true_class.rbs +0 -1
- data/core/warning.rbs +9 -2
- data/docs/architecture.md +1 -1
- data/docs/syntax.md +1 -1
- data/ext/rbs_extension/location.c +29 -19
- data/ext/rbs_extension/parser.c +267 -292
- data/ext/rbs_extension/parserstate.c +56 -22
- data/lib/rbs/annotate/annotations.rb +3 -3
- data/lib/rbs/annotate/rdoc_source.rb +2 -2
- data/lib/rbs/cli/diff.rb +3 -3
- data/lib/rbs/cli/validate.rb +1 -1
- data/lib/rbs/cli.rb +13 -13
- data/lib/rbs/collection/config.rb +3 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +3 -3
- data/lib/rbs/environment_loader.rb +1 -1
- data/lib/rbs/namespace.rb +1 -0
- data/lib/rbs/parser_aux.rb +2 -2
- data/lib/rbs/prototype/rb.rb +11 -8
- data/lib/rbs/prototype/rbi.rb +9 -5
- data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
- data/lib/rbs/prototype/runtime.rb +4 -5
- data/lib/rbs/type_name.rb +14 -9
- data/lib/rbs/unit_test/type_assertions.rb +2 -2
- data/lib/rbs/validator.rb +3 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +2 -2
- data/rbs.gemspec +4 -0
- data/sig/ancestor_graph.rbs +4 -4
- data/sig/namespace.rbs +2 -3
- data/sig/resolver/constant_resolver.rbs +2 -2
- data/sig/resolver/context.rbs +1 -1
- data/sig/type_alias_regularity.rbs +5 -5
- data/sig/typename.rbs +8 -5
- data/sig/use_map.rbs +1 -1
- data/sig/validator.rbs +2 -2
- data/stdlib/base64/0/base64.rbs +0 -9
- data/stdlib/benchmark/0/benchmark.rbs +11 -2
- data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
- data/stdlib/cgi/0/core.rbs +47 -0
- data/stdlib/coverage/0/coverage.rbs +0 -3
- data/stdlib/csv/0/csv.rbs +18 -58
- data/stdlib/date/0/date.rbs +4 -19
- data/stdlib/did_you_mean/0/did_you_mean.rbs +0 -5
- data/stdlib/digest/0/digest.rbs +25 -2
- data/stdlib/erb/0/erb.rbs +0 -1
- data/stdlib/etc/0/etc.rbs +51 -34
- data/stdlib/fileutils/0/fileutils.rbs +3 -44
- data/stdlib/io-console/0/io-console.rbs +69 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +8 -4
- data/stdlib/json/0/json.rbs +56 -71
- data/stdlib/logger/0/log_device.rbs +1 -1
- data/stdlib/logger/0/logger.rbs +3 -18
- data/stdlib/net-http/0/net-http.rbs +19 -77
- data/stdlib/nkf/0/nkf.rbs +30 -0
- data/stdlib/objspace/0/objspace.rbs +1 -2
- data/stdlib/observable/0/observable.rbs +1 -1
- data/stdlib/open-uri/0/open-uri.rbs +52 -0
- data/stdlib/open3/0/open3.rbs +0 -8
- data/stdlib/openssl/0/openssl.rbs +136 -69
- data/stdlib/optparse/0/optparse.rbs +58 -18
- data/stdlib/pathname/0/pathname.rbs +2 -8
- data/stdlib/pp/0/pp.rbs +3 -1
- data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
- data/stdlib/pstore/0/pstore.rbs +0 -6
- data/stdlib/psych/0/psych.rbs +15 -4
- data/stdlib/pty/0/pty.rbs +46 -4
- data/stdlib/rdoc/0/code_object.rbs +0 -4
- data/stdlib/rdoc/0/markup.rbs +10 -12
- data/stdlib/rdoc/0/rdoc.rbs +1 -2
- data/stdlib/resolv/0/resolv.rbs +8 -3
- data/stdlib/ripper/0/ripper.rbs +0 -2
- data/stdlib/securerandom/0/securerandom.rbs +0 -2
- data/stdlib/shellwords/0/shellwords.rbs +11 -12
- data/stdlib/singleton/0/singleton.rbs +0 -1
- data/stdlib/socket/0/addrinfo.rbs +0 -1
- data/stdlib/socket/0/basic_socket.rbs +0 -5
- data/stdlib/socket/0/socket.rbs +49 -25
- data/stdlib/socket/0/tcp_server.rbs +0 -3
- data/stdlib/socket/0/tcp_socket.rbs +58 -3
- data/stdlib/socket/0/udp_socket.rbs +0 -1
- data/stdlib/socket/0/unix_server.rbs +0 -3
- data/stdlib/strscan/0/string_scanner.rbs +1265 -422
- data/stdlib/tempfile/0/tempfile.rbs +135 -28
- data/stdlib/time/0/time.rbs +48 -35
- data/stdlib/timeout/0/timeout.rbs +11 -8
- data/stdlib/tmpdir/0/tmpdir.rbs +8 -1
- data/stdlib/tsort/0/tsort.rbs +0 -4
- data/stdlib/uri/0/common.rbs +11 -30
- data/stdlib/uri/0/ftp.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +22 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
- data/stdlib/zlib/0/buf_error.rbs +1 -70
- data/stdlib/zlib/0/data_error.rbs +1 -70
- data/stdlib/zlib/0/deflate.rbs +8 -72
- data/stdlib/zlib/0/error.rbs +1 -70
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
- data/stdlib/zlib/0/gzip_file.rbs +1 -71
- data/stdlib/zlib/0/gzip_reader.rbs +3 -74
- data/stdlib/zlib/0/gzip_writer.rbs +1 -70
- data/stdlib/zlib/0/inflate.rbs +4 -71
- data/stdlib/zlib/0/mem_error.rbs +1 -70
- data/stdlib/zlib/0/need_dict.rbs +1 -70
- data/stdlib/zlib/0/stream_end.rbs +1 -70
- data/stdlib/zlib/0/stream_error.rbs +1 -70
- data/stdlib/zlib/0/version_error.rbs +1 -70
- data/stdlib/zlib/0/zlib.rbs +0 -2
- data/stdlib/zlib/0/zstream.rbs +4 -72
- metadata +4 -6
data/stdlib/json/0/json.rbs
CHANGED
@@ -8,6 +8,8 @@ end
|
|
8
8
|
|
9
9
|
interface _JsonWrite
|
10
10
|
def write: (String json) -> void
|
11
|
+
|
12
|
+
def flush: () -> void
|
11
13
|
end
|
12
14
|
|
13
15
|
interface _JsonReadableIO
|
@@ -115,7 +117,6 @@ type json_state = singleton(JSON::Ext::Generator::State) | singleton(JSON::Pure:
|
|
115
117
|
# name is double-quoted text; the values may be any JSON values:
|
116
118
|
# {"a": "foo", "b": 1, "c": 1.0, "d": 2.0e2, "e": true, "f": false, "g": null}
|
117
119
|
#
|
118
|
-
#
|
119
120
|
# A JSON array or object may contain nested arrays, objects, and scalars to any
|
120
121
|
# depth:
|
121
122
|
# {"foo": {"bar": 1, "baz": 2}, "bat": [0, 1, 2]}
|
@@ -134,13 +135,11 @@ type json_state = singleton(JSON::Ext::Generator::State) | singleton(JSON::Pure:
|
|
134
135
|
# * `JSON.parse(source, opts)`
|
135
136
|
# * `JSON.parse!(source, opts)`
|
136
137
|
#
|
137
|
-
#
|
138
138
|
# where
|
139
139
|
# * `source` is a Ruby object.
|
140
140
|
# * `opts` is a Hash object containing options that control both input allowed
|
141
141
|
# and output formatting.
|
142
142
|
#
|
143
|
-
#
|
144
143
|
# The difference between the two methods is that JSON.parse! omits some checks
|
145
144
|
# and may not be safe for some `source` data; use it only for data from trusted
|
146
145
|
# sources. Use the safer method JSON.parse for less trusted sources.
|
@@ -298,7 +297,6 @@ type json_state = singleton(JSON::Ext::Generator::State) | singleton(JSON::Pure:
|
|
298
297
|
# * `opts` is a Hash object containing options that control both input allowed
|
299
298
|
# and output formatting.
|
300
299
|
#
|
301
|
-
#
|
302
300
|
# #### Generating JSON from Arrays
|
303
301
|
#
|
304
302
|
# When the source is a Ruby Array, JSON.generate returns a String containing a
|
@@ -417,7 +415,6 @@ type json_state = singleton(JSON::Ext::Generator::State) | singleton(JSON::Pure:
|
|
417
415
|
# inserted before the colon in each JSON object's pair; defaults to the
|
418
416
|
# empty String, `''`.
|
419
417
|
#
|
420
|
-
#
|
421
418
|
# In this example, `obj` is used first to generate the shortest JSON data (no
|
422
419
|
# whitespace), then again with all formatting options specified:
|
423
420
|
#
|
@@ -465,7 +462,6 @@ type json_state = singleton(JSON::Ext::Generator::State) | singleton(JSON::Pure:
|
|
465
462
|
# * JSON.parse, called with option `create_additions`, uses that information
|
466
463
|
# to create a proper Ruby object.
|
467
464
|
#
|
468
|
-
#
|
469
465
|
# This example shows a Range being generated into JSON and parsed back into
|
470
466
|
# Ruby, both without and with the addition for Range:
|
471
467
|
# ruby = Range.new(0, 2)
|
@@ -477,13 +473,13 @@ type json_state = singleton(JSON::Ext::Generator::State) | singleton(JSON::Pure:
|
|
477
473
|
# json1 = JSON.generate(ruby)
|
478
474
|
# ruby1 = JSON.parse(json1, create_additions: true)
|
479
475
|
# # Make a nice display.
|
480
|
-
# display =
|
481
|
-
#
|
482
|
-
#
|
483
|
-
#
|
484
|
-
#
|
485
|
-
#
|
486
|
-
#
|
476
|
+
# display = <<~EOT
|
477
|
+
# Generated JSON:
|
478
|
+
# Without addition: #{json0} (#{json0.class})
|
479
|
+
# With addition: #{json1} (#{json1.class})
|
480
|
+
# Parsed JSON:
|
481
|
+
# Without addition: #{ruby0.inspect} (#{ruby0.class})
|
482
|
+
# With addition: #{ruby1.inspect} (#{ruby1.class})
|
487
483
|
# EOT
|
488
484
|
# puts display
|
489
485
|
#
|
@@ -517,7 +513,6 @@ type json_state = singleton(JSON::Ext::Generator::State) | singleton(JSON::Pure:
|
|
517
513
|
# * Symbol: `require 'json/add/symbol'`
|
518
514
|
# * Time: `require 'json/add/time'`
|
519
515
|
#
|
520
|
-
#
|
521
516
|
# To reduce punctuation clutter, the examples below show the generated JSON via
|
522
517
|
# `puts`, rather than the usual `inspect`,
|
523
518
|
#
|
@@ -660,13 +655,13 @@ type json_state = singleton(JSON::Ext::Generator::State) | singleton(JSON::Pure:
|
|
660
655
|
# json1 = JSON.generate(foo1)
|
661
656
|
# obj1 = JSON.parse(json1, create_additions: true)
|
662
657
|
# # Make a nice display.
|
663
|
-
# display =
|
664
|
-
#
|
665
|
-
#
|
666
|
-
#
|
667
|
-
#
|
668
|
-
#
|
669
|
-
#
|
658
|
+
# display = <<~EOT
|
659
|
+
# Generated JSON:
|
660
|
+
# Without custom addition: #{json0} (#{json0.class})
|
661
|
+
# With custom addition: #{json1} (#{json1.class})
|
662
|
+
# Parsed JSON:
|
663
|
+
# Without custom addition: #{obj0.inspect} (#{obj0.class})
|
664
|
+
# With custom addition: #{obj1.inspect} (#{obj1.class})
|
670
665
|
# EOT
|
671
666
|
# puts display
|
672
667
|
#
|
@@ -731,7 +726,6 @@ module JSON
|
|
731
726
|
# * Argument `limit`, if given, is passed to JSON.generate as option
|
732
727
|
# `max_nesting`.
|
733
728
|
#
|
734
|
-
#
|
735
729
|
# ---
|
736
730
|
#
|
737
731
|
# When argument `io` is not given, returns the JSON String generated from `obj`:
|
@@ -756,14 +750,14 @@ module JSON
|
|
756
750
|
# <!-- rdoc-file=ext/json/lib/json/common.rb -->
|
757
751
|
# Sets or returns the default options for the JSON.dump method. Initially:
|
758
752
|
# opts = JSON.dump_default_options
|
759
|
-
# opts # => {:max_nesting=>false, :allow_nan=>true
|
753
|
+
# opts # => {:max_nesting=>false, :allow_nan=>true}
|
760
754
|
#
|
761
755
|
def self.dump_default_options: () -> json_options
|
762
756
|
|
763
757
|
# <!-- rdoc-file=ext/json/lib/json/common.rb -->
|
764
758
|
# Sets or returns the default options for the JSON.dump method. Initially:
|
765
759
|
# opts = JSON.dump_default_options
|
766
|
-
# opts # => {:max_nesting=>false, :allow_nan=>true
|
760
|
+
# opts # => {:max_nesting=>false, :allow_nan=>true}
|
767
761
|
#
|
768
762
|
def self.dump_default_options=: (json_options) -> json_options
|
769
763
|
|
@@ -828,9 +822,7 @@ module JSON
|
|
828
822
|
def self?.generate: (_ToJson obj, ?json_options opts) -> String
|
829
823
|
|
830
824
|
# <!-- rdoc-file=ext/json/lib/json/common.rb -->
|
831
|
-
# Returns the JSON generator module that is used by JSON.
|
832
|
-
# JSON::Ext::Generator or JSON::Pure::Generator:
|
833
|
-
# JSON.generator # => JSON::Ext::Generator
|
825
|
+
# Returns the JSON generator module that is used by JSON.
|
834
826
|
#
|
835
827
|
def self.generator: () -> json_generator
|
836
828
|
|
@@ -850,6 +842,15 @@ module JSON
|
|
850
842
|
# -->
|
851
843
|
# Returns the Ruby objects created by parsing the given `source`.
|
852
844
|
#
|
845
|
+
# BEWARE: This method is meant to serialise data from trusted user input, like
|
846
|
+
# from your own database server or clients under your control, it could be
|
847
|
+
# dangerous to allow untrusted users to pass JSON sources into it. If you must
|
848
|
+
# use it, use JSON.unsafe_load instead to make it clear.
|
849
|
+
#
|
850
|
+
# Since JSON version 2.8.0, `load` emits a deprecation warning when a non native
|
851
|
+
# type is deserialized, without `create_additions` being explicitly enabled, and
|
852
|
+
# in JSON version 3.0, `load` will have `create_additions` disabled by default.
|
853
|
+
#
|
853
854
|
# * Argument `source` must be, or be convertible to, a String:
|
854
855
|
# * If `source` responds to instance method `to_str`, `source.to_str`
|
855
856
|
# becomes the source.
|
@@ -860,37 +861,31 @@ module JSON
|
|
860
861
|
# * If both of the following are true, source becomes the String `'null'`:
|
861
862
|
# * Option `allow_blank` specifies a truthy value.
|
862
863
|
# * The source, as defined above, is `nil` or the empty String `''`.
|
863
|
-
#
|
864
864
|
# * Otherwise, `source` remains the source.
|
865
|
-
#
|
866
865
|
# * Argument `proc`, if given, must be a Proc that accepts one argument. It
|
867
866
|
# will be called recursively with each result (depth-first order). See
|
868
|
-
# details below.
|
869
|
-
# user input, like from your own database server or clients under your
|
870
|
-
# control, it could be dangerous to allow untrusted users to pass JSON
|
871
|
-
# sources into it.
|
867
|
+
# details below.
|
872
868
|
# * Argument `opts`, if given, contains a Hash of options for the parsing. See
|
873
869
|
# [Parsing Options](#module-JSON-label-Parsing+Options). The default options
|
874
870
|
# can be changed via method JSON.load_default_options=.
|
875
871
|
#
|
876
|
-
#
|
877
872
|
# ---
|
878
873
|
#
|
879
874
|
# When no `proc` is given, modifies `source` as above and returns the result of
|
880
875
|
# `parse(source, opts)`; see #parse.
|
881
876
|
#
|
882
877
|
# Source for following examples:
|
883
|
-
# source =
|
884
|
-
#
|
885
|
-
#
|
886
|
-
#
|
887
|
-
#
|
888
|
-
#
|
889
|
-
#
|
890
|
-
#
|
891
|
-
#
|
892
|
-
#
|
893
|
-
#
|
878
|
+
# source = <<~JSON
|
879
|
+
# {
|
880
|
+
# "name": "Dave",
|
881
|
+
# "age" :40,
|
882
|
+
# "hats": [
|
883
|
+
# "Cattleman's",
|
884
|
+
# "Panama",
|
885
|
+
# "Tophat"
|
886
|
+
# ]
|
887
|
+
# }
|
888
|
+
# JSON
|
894
889
|
#
|
895
890
|
# Load a String:
|
896
891
|
# ruby = JSON.load(source)
|
@@ -916,7 +911,6 @@ module JSON
|
|
916
911
|
# * Recursively calls `proc(result)`.
|
917
912
|
# * Returns the final result.
|
918
913
|
#
|
919
|
-
#
|
920
914
|
# Example:
|
921
915
|
# require 'json'
|
922
916
|
#
|
@@ -1045,17 +1039,17 @@ module JSON
|
|
1045
1039
|
# \JSON](#module-JSON-label-Parsing+JSON).
|
1046
1040
|
#
|
1047
1041
|
# Parses nested JSON objects:
|
1048
|
-
# source =
|
1049
|
-
#
|
1050
|
-
#
|
1051
|
-
#
|
1052
|
-
#
|
1053
|
-
#
|
1054
|
-
#
|
1055
|
-
#
|
1056
|
-
#
|
1057
|
-
#
|
1058
|
-
#
|
1042
|
+
# source = <<~JSON
|
1043
|
+
# {
|
1044
|
+
# "name": "Dave",
|
1045
|
+
# "age" :40,
|
1046
|
+
# "hats": [
|
1047
|
+
# "Cattleman's",
|
1048
|
+
# "Panama",
|
1049
|
+
# "Tophat"
|
1050
|
+
# ]
|
1051
|
+
# }
|
1052
|
+
# JSON
|
1059
1053
|
# ruby = JSON.parse(source)
|
1060
1054
|
# ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
|
1061
1055
|
#
|
@@ -1084,9 +1078,7 @@ module JSON
|
|
1084
1078
|
def self?.parse!: (string source, ?json_options opts) -> untyped
|
1085
1079
|
|
1086
1080
|
# <!-- rdoc-file=ext/json/lib/json/common.rb -->
|
1087
|
-
# Returns the JSON parser class that is used by JSON.
|
1088
|
-
# JSON::Ext::Parser or JSON::Pure::Parser:
|
1089
|
-
# JSON.parser # => JSON::Ext::Parser
|
1081
|
+
# Returns the JSON parser class that is used by JSON.
|
1090
1082
|
#
|
1091
1083
|
def self.parser: () -> json_parser
|
1092
1084
|
|
@@ -1137,29 +1129,25 @@ module JSON
|
|
1137
1129
|
|
1138
1130
|
# <!--
|
1139
1131
|
# rdoc-file=ext/json/lib/json/common.rb
|
1140
|
-
# - restore(source, proc = nil, options =
|
1132
|
+
# - restore(source, proc = nil, options = nil)
|
1141
1133
|
# -->
|
1142
1134
|
#
|
1143
1135
|
alias self.restore self.load
|
1144
1136
|
|
1145
1137
|
# <!--
|
1146
1138
|
# rdoc-file=ext/json/lib/json/common.rb
|
1147
|
-
# - restore(source, proc = nil, options =
|
1139
|
+
# - restore(source, proc = nil, options = nil)
|
1148
1140
|
# -->
|
1149
1141
|
#
|
1150
1142
|
alias restore load
|
1151
1143
|
|
1152
1144
|
# <!-- rdoc-file=ext/json/lib/json/common.rb -->
|
1153
|
-
# Sets or Returns the JSON generator state class that is used by JSON.
|
1154
|
-
# either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
|
1155
|
-
# JSON.state # => JSON::Ext::Generator::State
|
1145
|
+
# Sets or Returns the JSON generator state class that is used by JSON.
|
1156
1146
|
#
|
1157
1147
|
def self.state: () -> json_state
|
1158
1148
|
|
1159
1149
|
# <!-- rdoc-file=ext/json/lib/json/common.rb -->
|
1160
|
-
# Sets or Returns the JSON generator state class that is used by JSON.
|
1161
|
-
# either JSON::Ext::Generator::State or JSON::Pure::Generator::State:
|
1162
|
-
# JSON.state # => JSON::Ext::Generator::State
|
1150
|
+
# Sets or Returns the JSON generator state class that is used by JSON.
|
1163
1151
|
#
|
1164
1152
|
def self.state=: (json_state) -> json_state
|
1165
1153
|
|
@@ -1182,9 +1170,6 @@ JSON::PRETTY_STATE_PROTOTYPE: json_state
|
|
1182
1170
|
|
1183
1171
|
JSON::SAFE_STATE_PROTOTYPE: json_state
|
1184
1172
|
|
1185
|
-
# <!-- rdoc-file=ext/json/lib/json/version.rb -->
|
1186
|
-
# JSON version
|
1187
|
-
#
|
1188
1173
|
JSON::VERSION: String
|
1189
1174
|
|
1190
1175
|
JSON::VERSION_ARRAY: Array[Integer]
|
@@ -57,7 +57,7 @@ class Logger
|
|
57
57
|
|
58
58
|
# <!--
|
59
59
|
# rdoc-file=lib/logger/log_device.rb
|
60
|
-
# - new(log = nil, shift_age: nil, shift_size: nil, shift_period_suffix: nil, binmode: false)
|
60
|
+
# - new(log = nil, shift_age: nil, shift_size: nil, shift_period_suffix: nil, binmode: false, reraise_write_errors: [])
|
61
61
|
# -->
|
62
62
|
#
|
63
63
|
def initialize: (?untyped logdev, ?binmode: boolish, ?shift_period_suffix: String, ?shift_size: Integer, ?shift_age: Numeric | String) -> void
|
data/stdlib/logger/0/logger.rbs
CHANGED
@@ -66,13 +66,11 @@
|
|
66
66
|
# * A severity (the required argument to #add).
|
67
67
|
# * An automatically created timestamp.
|
68
68
|
#
|
69
|
-
#
|
70
69
|
# And may also have:
|
71
70
|
#
|
72
71
|
# * A message.
|
73
72
|
# * A program name.
|
74
73
|
#
|
75
|
-
#
|
76
74
|
# Example:
|
77
75
|
#
|
78
76
|
# logger = Logger.new($stdout)
|
@@ -92,7 +90,6 @@
|
|
92
90
|
# * Program name.
|
93
91
|
# * Message.
|
94
92
|
#
|
95
|
-
#
|
96
93
|
# You can use a different entry format by:
|
97
94
|
#
|
98
95
|
# * Setting a custom format proc (affects following entries); see
|
@@ -112,8 +109,6 @@
|
|
112
109
|
#
|
113
110
|
# logger.error("#{my_slow_message_generator}")
|
114
111
|
#
|
115
|
-
#
|
116
|
-
#
|
117
112
|
# ### Severity
|
118
113
|
#
|
119
114
|
# The severity of a log entry has two effects:
|
@@ -123,7 +118,6 @@
|
|
123
118
|
# * Indicates to any log reader (whether a person or a program) the relative
|
124
119
|
# importance of the entry.
|
125
120
|
#
|
126
|
-
#
|
127
121
|
# ### Timestamp
|
128
122
|
#
|
129
123
|
# The timestamp for a log entry is generated automatically when the entry is
|
@@ -157,7 +151,6 @@
|
|
157
151
|
# * An Exception: `message.message` is used.
|
158
152
|
# * Anything else: `message.inspect` is used.
|
159
153
|
#
|
160
|
-
#
|
161
154
|
# **Note**: Logger::Formatter does not escape or sanitize the message passed to
|
162
155
|
# it. Developers should be aware that malicious data (user input) may be in the
|
163
156
|
# message, and should explicitly escape untrusted data.
|
@@ -271,7 +264,6 @@
|
|
271
264
|
# * Only the most recent log file is open and active; the others are closed
|
272
265
|
# and inactive.
|
273
266
|
#
|
274
|
-
#
|
275
267
|
# ### Size-Based Rotation
|
276
268
|
#
|
277
269
|
# For size-based log file rotation, call Logger.new with:
|
@@ -282,7 +274,6 @@
|
|
282
274
|
# * Argument `shift_size` as a positive integer: the maximum size (in bytes)
|
283
275
|
# of each log file; defaults to 1048576 (1 megabyte).
|
284
276
|
#
|
285
|
-
#
|
286
277
|
# Examples:
|
287
278
|
#
|
288
279
|
# logger = Logger.new('t.log', 3) # Three 1-megabyte files.
|
@@ -300,14 +291,12 @@
|
|
300
291
|
# * `t.log` is closed and renamed to `t.log.0`.
|
301
292
|
# * A new file `t.log` is opened.
|
302
293
|
#
|
303
|
-
#
|
304
294
|
# The second time `t.log` is full:
|
305
295
|
#
|
306
296
|
# * +t.log.0 is renamed as `t.log.1`.
|
307
297
|
# * `t.log` is closed and renamed to `t.log.0`.
|
308
298
|
# * A new file `t.log` is opened.
|
309
299
|
#
|
310
|
-
#
|
311
300
|
# Each subsequent time that `t.log` is full, the log files are rotated:
|
312
301
|
#
|
313
302
|
# * `t.log.1` is removed.
|
@@ -315,7 +304,6 @@
|
|
315
304
|
# * `t.log` is closed and renamed to `t.log.0`.
|
316
305
|
# * A new file `t.log` is opened.
|
317
306
|
#
|
318
|
-
#
|
319
307
|
# ### Periodic Rotation
|
320
308
|
#
|
321
309
|
# For periodic rotation, call Logger.new with:
|
@@ -323,7 +311,6 @@
|
|
323
311
|
# * Argument `logdev` as a file path.
|
324
312
|
# * Argument `shift_age` as a string period indicator.
|
325
313
|
#
|
326
|
-
#
|
327
314
|
# Examples:
|
328
315
|
#
|
329
316
|
# logger = Logger.new('t.log', 'daily') # Rotate log files daily.
|
@@ -341,7 +328,6 @@
|
|
341
328
|
# * A new log file `t.log` is opened.
|
342
329
|
# * Nothing is removed.
|
343
330
|
#
|
344
|
-
#
|
345
331
|
# The default format for the suffix is `'%Y%m%d'`, which produces a suffix
|
346
332
|
# similar to the one above. You can set a different format using create-time
|
347
333
|
# option `shift_period_suffix`; see details and suggestions at
|
@@ -534,7 +520,6 @@ class Logger
|
|
534
520
|
# * `progname`: The program name for the entry.
|
535
521
|
# * `msg`: The message for the entry (string or string-convertible object).
|
536
522
|
#
|
537
|
-
#
|
538
523
|
# The proc should return a string containing the formatted entry.
|
539
524
|
#
|
540
525
|
# This custom formatter uses [String#dump](rdoc-ref:String#dump) to escape the
|
@@ -568,7 +553,6 @@ class Logger
|
|
568
553
|
# * `progname`: The program name for the entry.
|
569
554
|
# * `msg`: The message for the entry (string or string-convertible object).
|
570
555
|
#
|
571
|
-
#
|
572
556
|
# The proc should return a string containing the formatted entry.
|
573
557
|
#
|
574
558
|
# This custom formatter uses [String#dump](rdoc-ref:String#dump) to escape the
|
@@ -670,7 +654,6 @@ class Logger
|
|
670
654
|
# * If `logdev` is an IO stream (usually `$stdout`, `$stderr`, or an open File
|
671
655
|
# object), opens the stream for append.
|
672
656
|
#
|
673
|
-
#
|
674
657
|
# Example:
|
675
658
|
#
|
676
659
|
# logger = Logger.new('t.log')
|
@@ -770,7 +753,6 @@ class Logger
|
|
770
753
|
# are to be written to the given stream.
|
771
754
|
# * `nil` or `File::NULL`: no entries are to be written.
|
772
755
|
#
|
773
|
-
#
|
774
756
|
# Examples:
|
775
757
|
#
|
776
758
|
# Logger.new('t.log')
|
@@ -797,6 +779,9 @@ class Logger
|
|
797
779
|
# * `shift_period_suffix`: sets the format for the filename suffix for
|
798
780
|
# periodic log file rotation; default is `'%Y%m%d'`. See [Periodic
|
799
781
|
# Rotation](rdoc-ref:Logger@Periodic+Rotation).
|
782
|
+
# * `reraise_write_errors`: An array of exception classes, which will be
|
783
|
+
# reraised if there is an error when writing to the log device. The default
|
784
|
+
# is to swallow all exceptions raised.
|
800
785
|
#
|
801
786
|
def initialize: (logdev? logdev, ?Numeric | String shift_age, ?Integer shift_size, ?shift_period_suffix: String, ?binmode: boolish, ?datetime_format: String, ?formatter: _Formatter, ?progname: String, ?level: Integer | interned) -> void
|
802
787
|
end
|