sorbet-result 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.standard.yml +6 -0
- data/.tool-versions +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile +2 -4
- data/Gemfile.lock +75 -55
- data/README.md +23 -0
- data/Rakefile +3 -5
- data/lib/minitest/result_assertions.rb +48 -0
- data/lib/sorbet-result.rb +1 -5
- data/lib/typed/result.rb +169 -7
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
- data/sorbet/rbi/gems/{json@2.6.3.rbi → json@2.7.1.rbi} +80 -60
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +239 -0
- data/sorbet/rbi/gems/{minitest@5.18.1.rbi → minitest@5.22.2.rbi} +285 -241
- data/sorbet/rbi/gems/{parallel@1.23.0.rbi → parallel@1.24.0.rbi} +8 -1
- data/sorbet/rbi/gems/{parser@3.2.2.3.rbi → parser@3.3.0.5.rbi} +438 -2219
- data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
- data/sorbet/rbi/gems/prism@0.24.0.rbi +31040 -0
- data/sorbet/rbi/gems/psych@5.1.2.rbi +1731 -0
- data/sorbet/rbi/gems/{racc@1.7.1.rbi → racc@1.7.3.rbi} +35 -39
- data/sorbet/rbi/gems/{rake@13.0.6.rbi → rake@13.1.0.rbi} +68 -65
- data/sorbet/rbi/gems/{rbi@0.0.16.rbi → rbi@0.1.9.rbi} +712 -714
- data/sorbet/rbi/gems/{regexp_parser@2.8.1.rbi → regexp_parser@2.9.0.rbi} +187 -165
- data/sorbet/rbi/gems/{rexml@3.2.5.rbi → rexml@3.2.6.rbi} +116 -52
- data/sorbet/rbi/gems/{rubocop-ast@1.29.0.rbi → rubocop-ast@1.30.0.rbi} +77 -77
- data/sorbet/rbi/gems/rubocop-performance@1.20.2.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.7.7.rbi +8 -0
- data/sorbet/rbi/gems/{rubocop@1.52.1.rbi → rubocop@1.60.2.rbi} +3593 -1700
- data/sorbet/rbi/gems/{spoom@1.2.1.rbi → spoom@1.2.4.rbi} +1378 -104
- data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +8 -0
- data/sorbet/rbi/gems/standard-performance@1.3.1.rbi +8 -0
- data/sorbet/rbi/gems/standard-sorbet@0.0.2.rbi +52 -0
- data/sorbet/rbi/gems/standard@1.34.0.rbi +850 -0
- data/sorbet/rbi/gems/stringio@3.1.0.rbi +8 -0
- data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23133 -0
- data/sorbet/rbi/gems/{tapioca@0.11.6.rbi → tapioca@0.12.0.rbi} +776 -574
- data/sorbet/rbi/gems/{thor@1.2.2.rbi → thor@1.3.0.rbi} +775 -395
- data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +1 -1
- data/sorbet/rbi/gems/yard@0.9.34.rbi +2 -2
- data/sorbet/tapioca/config.yml +3 -12
- data/sorbet/tapioca/require.rb +0 -1
- metadata +41 -34
- data/.rubocop.yml +0 -33
- data/lib/typed/failure.rb +0 -81
- data/lib/typed/success.rb +0 -80
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1083
- data/sorbet/rbi/gems/irb@1.7.0.rbi +0 -342
- data/sorbet/rbi/gems/rubocop-minitest@0.31.0.rbi +0 -2528
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +0 -328
- data/sorbet/rbi/gems/rubocop-sorbet@0.7.0.rbi +0 -1043
- data/sorbet/rbi/gems/unparser@0.6.8.rbi +0 -4525
- data/sorbet/rbi/gems/zeitwerk@2.6.8.rbi +0 -986
- /data/sorbet/rbi/gems/{io-console@0.6.0.rbi → io-console@0.7.2.rbi} +0 -0
- /data/sorbet/rbi/gems/{reline@0.3.5.rbi → reline@0.4.2.rbi} +0 -0
- /data/sorbet/rbi/gems/{unicode-display_width@2.4.2.rbi → unicode-display_width@2.5.0.rbi} +0 -0
@@ -0,0 +1,1731 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `psych` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem psych`.
|
6
|
+
|
7
|
+
class Object < ::BasicObject
|
8
|
+
include ::Kernel
|
9
|
+
include ::PP::ObjectMixin
|
10
|
+
|
11
|
+
# call-seq: to_yaml(options = {})
|
12
|
+
#
|
13
|
+
# Convert an object to YAML. See Psych.dump for more information on the
|
14
|
+
# available +options+.
|
15
|
+
#
|
16
|
+
# source://psych//psych/core_ext.rb#12
|
17
|
+
def to_yaml(options = T.unsafe(nil)); end
|
18
|
+
|
19
|
+
class << self
|
20
|
+
# source://psych//psych/core_ext.rb#3
|
21
|
+
def yaml_tag(url); end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# = Overview
|
26
|
+
#
|
27
|
+
# Psych is a YAML parser and emitter.
|
28
|
+
# Psych leverages libyaml [Home page: https://pyyaml.org/wiki/LibYAML]
|
29
|
+
# or [git repo: https://github.com/yaml/libyaml] for its YAML parsing
|
30
|
+
# and emitting capabilities. In addition to wrapping libyaml, Psych also
|
31
|
+
# knows how to serialize and de-serialize most Ruby objects to and from
|
32
|
+
# the YAML format.
|
33
|
+
#
|
34
|
+
# = I NEED TO PARSE OR EMIT YAML RIGHT NOW!
|
35
|
+
#
|
36
|
+
# # Parse some YAML
|
37
|
+
# Psych.load("--- foo") # => "foo"
|
38
|
+
#
|
39
|
+
# # Emit some YAML
|
40
|
+
# Psych.dump("foo") # => "--- foo\n...\n"
|
41
|
+
# { :a => 'b'}.to_yaml # => "---\n:a: b\n"
|
42
|
+
#
|
43
|
+
# Got more time on your hands? Keep on reading!
|
44
|
+
#
|
45
|
+
# == YAML Parsing
|
46
|
+
#
|
47
|
+
# Psych provides a range of interfaces for parsing a YAML document ranging from
|
48
|
+
# low level to high level, depending on your parsing needs. At the lowest
|
49
|
+
# level, is an event based parser. Mid level is access to the raw YAML AST,
|
50
|
+
# and at the highest level is the ability to unmarshal YAML to Ruby objects.
|
51
|
+
#
|
52
|
+
# == YAML Emitting
|
53
|
+
#
|
54
|
+
# Psych provides a range of interfaces ranging from low to high level for
|
55
|
+
# producing YAML documents. Very similar to the YAML parsing interfaces, Psych
|
56
|
+
# provides at the lowest level, an event based system, mid-level is building
|
57
|
+
# a YAML AST, and the highest level is converting a Ruby object straight to
|
58
|
+
# a YAML document.
|
59
|
+
#
|
60
|
+
# == High-level API
|
61
|
+
#
|
62
|
+
# === Parsing
|
63
|
+
#
|
64
|
+
# The high level YAML parser provided by Psych simply takes YAML as input and
|
65
|
+
# returns a Ruby data structure. For information on using the high level parser
|
66
|
+
# see Psych.load
|
67
|
+
#
|
68
|
+
# ==== Reading from a string
|
69
|
+
#
|
70
|
+
# Psych.safe_load("--- a") # => 'a'
|
71
|
+
# Psych.safe_load("---\n - a\n - b") # => ['a', 'b']
|
72
|
+
# # From a trusted string:
|
73
|
+
# Psych.load("--- !ruby/range\nbegin: 0\nend: 42\nexcl: false\n") # => 0..42
|
74
|
+
#
|
75
|
+
# ==== Reading from a file
|
76
|
+
#
|
77
|
+
# Psych.safe_load_file("data.yml", permitted_classes: [Date])
|
78
|
+
# Psych.load_file("trusted_database.yml")
|
79
|
+
#
|
80
|
+
# ==== Exception handling
|
81
|
+
#
|
82
|
+
# begin
|
83
|
+
# # The second argument changes only the exception contents
|
84
|
+
# Psych.parse("--- `", "file.txt")
|
85
|
+
# rescue Psych::SyntaxError => ex
|
86
|
+
# ex.file # => 'file.txt'
|
87
|
+
# ex.message # => "(file.txt): found character that cannot start any token"
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# === Emitting
|
91
|
+
#
|
92
|
+
# The high level emitter has the easiest interface. Psych simply takes a Ruby
|
93
|
+
# data structure and converts it to a YAML document. See Psych.dump for more
|
94
|
+
# information on dumping a Ruby data structure.
|
95
|
+
#
|
96
|
+
# ==== Writing to a string
|
97
|
+
#
|
98
|
+
# # Dump an array, get back a YAML string
|
99
|
+
# Psych.dump(['a', 'b']) # => "---\n- a\n- b\n"
|
100
|
+
#
|
101
|
+
# # Dump an array to an IO object
|
102
|
+
# Psych.dump(['a', 'b'], StringIO.new) # => #<StringIO:0x000001009d0890>
|
103
|
+
#
|
104
|
+
# # Dump an array with indentation set
|
105
|
+
# Psych.dump(['a', ['b']], :indentation => 3) # => "---\n- a\n- - b\n"
|
106
|
+
#
|
107
|
+
# # Dump an array to an IO with indentation set
|
108
|
+
# Psych.dump(['a', ['b']], StringIO.new, :indentation => 3)
|
109
|
+
#
|
110
|
+
# ==== Writing to a file
|
111
|
+
#
|
112
|
+
# Currently there is no direct API for dumping Ruby structure to file:
|
113
|
+
#
|
114
|
+
# File.open('database.yml', 'w') do |file|
|
115
|
+
# file.write(Psych.dump(['a', 'b']))
|
116
|
+
# end
|
117
|
+
#
|
118
|
+
# == Mid-level API
|
119
|
+
#
|
120
|
+
# === Parsing
|
121
|
+
#
|
122
|
+
# Psych provides access to an AST produced from parsing a YAML document. This
|
123
|
+
# tree is built using the Psych::Parser and Psych::TreeBuilder. The AST can
|
124
|
+
# be examined and manipulated freely. Please see Psych::parse_stream,
|
125
|
+
# Psych::Nodes, and Psych::Nodes::Node for more information on dealing with
|
126
|
+
# YAML syntax trees.
|
127
|
+
#
|
128
|
+
# ==== Reading from a string
|
129
|
+
#
|
130
|
+
# # Returns Psych::Nodes::Stream
|
131
|
+
# Psych.parse_stream("---\n - a\n - b")
|
132
|
+
#
|
133
|
+
# # Returns Psych::Nodes::Document
|
134
|
+
# Psych.parse("---\n - a\n - b")
|
135
|
+
#
|
136
|
+
# ==== Reading from a file
|
137
|
+
#
|
138
|
+
# # Returns Psych::Nodes::Stream
|
139
|
+
# Psych.parse_stream(File.read('database.yml'))
|
140
|
+
#
|
141
|
+
# # Returns Psych::Nodes::Document
|
142
|
+
# Psych.parse_file('database.yml')
|
143
|
+
#
|
144
|
+
# ==== Exception handling
|
145
|
+
#
|
146
|
+
# begin
|
147
|
+
# # The second argument changes only the exception contents
|
148
|
+
# Psych.parse("--- `", "file.txt")
|
149
|
+
# rescue Psych::SyntaxError => ex
|
150
|
+
# ex.file # => 'file.txt'
|
151
|
+
# ex.message # => "(file.txt): found character that cannot start any token"
|
152
|
+
# end
|
153
|
+
#
|
154
|
+
# === Emitting
|
155
|
+
#
|
156
|
+
# At the mid level is building an AST. This AST is exactly the same as the AST
|
157
|
+
# used when parsing a YAML document. Users can build an AST by hand and the
|
158
|
+
# AST knows how to emit itself as a YAML document. See Psych::Nodes,
|
159
|
+
# Psych::Nodes::Node, and Psych::TreeBuilder for more information on building
|
160
|
+
# a YAML AST.
|
161
|
+
#
|
162
|
+
# ==== Writing to a string
|
163
|
+
#
|
164
|
+
# # We need Psych::Nodes::Stream (not Psych::Nodes::Document)
|
165
|
+
# stream = Psych.parse_stream("---\n - a\n - b")
|
166
|
+
#
|
167
|
+
# stream.to_yaml # => "---\n- a\n- b\n"
|
168
|
+
#
|
169
|
+
# ==== Writing to a file
|
170
|
+
#
|
171
|
+
# # We need Psych::Nodes::Stream (not Psych::Nodes::Document)
|
172
|
+
# stream = Psych.parse_stream(File.read('database.yml'))
|
173
|
+
#
|
174
|
+
# File.open('database.yml', 'w') do |file|
|
175
|
+
# file.write(stream.to_yaml)
|
176
|
+
# end
|
177
|
+
#
|
178
|
+
# == Low-level API
|
179
|
+
#
|
180
|
+
# === Parsing
|
181
|
+
#
|
182
|
+
# The lowest level parser should be used when the YAML input is already known,
|
183
|
+
# and the developer does not want to pay the price of building an AST or
|
184
|
+
# automatic detection and conversion to Ruby objects. See Psych::Parser for
|
185
|
+
# more information on using the event based parser.
|
186
|
+
#
|
187
|
+
# ==== Reading to Psych::Nodes::Stream structure
|
188
|
+
#
|
189
|
+
# parser = Psych::Parser.new(TreeBuilder.new) # => #<Psych::Parser>
|
190
|
+
# parser = Psych.parser # it's an alias for the above
|
191
|
+
#
|
192
|
+
# parser.parse("---\n - a\n - b") # => #<Psych::Parser>
|
193
|
+
# parser.handler # => #<Psych::TreeBuilder>
|
194
|
+
# parser.handler.root # => #<Psych::Nodes::Stream>
|
195
|
+
#
|
196
|
+
# ==== Receiving an events stream
|
197
|
+
#
|
198
|
+
# recorder = Psych::Handlers::Recorder.new
|
199
|
+
# parser = Psych::Parser.new(recorder)
|
200
|
+
#
|
201
|
+
# parser.parse("---\n - a\n - b")
|
202
|
+
# recorder.events # => [list of [event, args] lists]
|
203
|
+
# # event is one of: Psych::Handler::EVENTS
|
204
|
+
# # args are the arguments passed to the event
|
205
|
+
#
|
206
|
+
# === Emitting
|
207
|
+
#
|
208
|
+
# The lowest level emitter is an event based system. Events are sent to a
|
209
|
+
# Psych::Emitter object. That object knows how to convert the events to a YAML
|
210
|
+
# document. This interface should be used when document format is known in
|
211
|
+
# advance or speed is a concern. See Psych::Emitter for more information.
|
212
|
+
#
|
213
|
+
# ==== Writing to a Ruby structure
|
214
|
+
#
|
215
|
+
# Psych.parser.parse("--- a") # => #<Psych::Parser>
|
216
|
+
#
|
217
|
+
# parser.handler.first # => #<Psych::Nodes::Stream>
|
218
|
+
# parser.handler.first.to_ruby # => ["a"]
|
219
|
+
#
|
220
|
+
# parser.handler.root.first # => #<Psych::Nodes::Document>
|
221
|
+
# parser.handler.root.first.to_ruby # => "a"
|
222
|
+
#
|
223
|
+
# # You can instantiate an Emitter manually
|
224
|
+
# Psych::Visitors::ToRuby.new.accept(parser.handler.root.first)
|
225
|
+
# # => "a"
|
226
|
+
module Psych
|
227
|
+
class << self
|
228
|
+
# source://psych//psych.rb#682
|
229
|
+
def add_builtin_type(type_tag, &block); end
|
230
|
+
|
231
|
+
# :stopdoc:
|
232
|
+
#
|
233
|
+
# source://psych//psych.rb#676
|
234
|
+
def add_domain_type(domain, type_tag, &block); end
|
235
|
+
|
236
|
+
# source://psych//psych.rb#692
|
237
|
+
def add_tag(tag, klass); end
|
238
|
+
|
239
|
+
# source://psych//psych.rb#708
|
240
|
+
def config; end
|
241
|
+
|
242
|
+
# source://psych//psych.rb#720
|
243
|
+
def domain_types; end
|
244
|
+
|
245
|
+
# source://psych//psych.rb#732
|
246
|
+
def domain_types=(value); end
|
247
|
+
|
248
|
+
# call-seq:
|
249
|
+
# Psych.dump(o) -> string of yaml
|
250
|
+
# Psych.dump(o, options) -> string of yaml
|
251
|
+
# Psych.dump(o, io) -> io object passed in
|
252
|
+
# Psych.dump(o, io, options) -> io object passed in
|
253
|
+
#
|
254
|
+
# Dump Ruby object +o+ to a YAML string. Optional +options+ may be passed in
|
255
|
+
# to control the output format. If an IO object is passed in, the YAML will
|
256
|
+
# be dumped to that IO object.
|
257
|
+
#
|
258
|
+
# Currently supported options are:
|
259
|
+
#
|
260
|
+
# [<tt>:indentation</tt>] Number of space characters used to indent.
|
261
|
+
# Acceptable value should be in <tt>0..9</tt> range,
|
262
|
+
# otherwise option is ignored.
|
263
|
+
#
|
264
|
+
# Default: <tt>2</tt>.
|
265
|
+
# [<tt>:line_width</tt>] Max character to wrap line at.
|
266
|
+
#
|
267
|
+
# Default: <tt>0</tt> (meaning "wrap at 81").
|
268
|
+
# [<tt>:canonical</tt>] Write "canonical" YAML form (very verbose, yet
|
269
|
+
# strictly formal).
|
270
|
+
#
|
271
|
+
# Default: <tt>false</tt>.
|
272
|
+
# [<tt>:header</tt>] Write <tt>%YAML [version]</tt> at the beginning of document.
|
273
|
+
#
|
274
|
+
# Default: <tt>false</tt>.
|
275
|
+
#
|
276
|
+
# Example:
|
277
|
+
#
|
278
|
+
# # Dump an array, get back a YAML string
|
279
|
+
# Psych.dump(['a', 'b']) # => "---\n- a\n- b\n"
|
280
|
+
#
|
281
|
+
# # Dump an array to an IO object
|
282
|
+
# Psych.dump(['a', 'b'], StringIO.new) # => #<StringIO:0x000001009d0890>
|
283
|
+
#
|
284
|
+
# # Dump an array with indentation set
|
285
|
+
# Psych.dump(['a', ['b']], indentation: 3) # => "---\n- a\n- - b\n"
|
286
|
+
#
|
287
|
+
# # Dump an array to an IO with indentation set
|
288
|
+
# Psych.dump(['a', ['b']], StringIO.new, indentation: 3)
|
289
|
+
#
|
290
|
+
# source://psych//psych.rb#505
|
291
|
+
def dump(o, io = T.unsafe(nil), options = T.unsafe(nil)); end
|
292
|
+
|
293
|
+
# Dump a list of objects as separate documents to a document stream.
|
294
|
+
#
|
295
|
+
# Example:
|
296
|
+
#
|
297
|
+
# Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"
|
298
|
+
#
|
299
|
+
# source://psych//psych.rb#595
|
300
|
+
def dump_stream(*objects); end
|
301
|
+
|
302
|
+
# source://psych//psych.rb#716
|
303
|
+
def dump_tags; end
|
304
|
+
|
305
|
+
# source://psych//psych.rb#728
|
306
|
+
def dump_tags=(value); end
|
307
|
+
|
308
|
+
# Load +yaml+ in to a Ruby data structure. If multiple documents are
|
309
|
+
# provided, the object contained in the first document will be returned.
|
310
|
+
# +filename+ will be used in the exception message if any exception
|
311
|
+
# is raised while parsing. If +yaml+ is empty, it returns
|
312
|
+
# the specified +fallback+ return value, which defaults to +false+.
|
313
|
+
#
|
314
|
+
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
|
315
|
+
#
|
316
|
+
# Example:
|
317
|
+
#
|
318
|
+
# Psych.load("--- a") # => 'a'
|
319
|
+
# Psych.load("---\n - a\n - b") # => ['a', 'b']
|
320
|
+
#
|
321
|
+
# begin
|
322
|
+
# Psych.load("--- `", filename: "file.txt")
|
323
|
+
# rescue Psych::SyntaxError => ex
|
324
|
+
# ex.file # => 'file.txt'
|
325
|
+
# ex.message # => "(file.txt): found character that cannot start any token"
|
326
|
+
# end
|
327
|
+
#
|
328
|
+
# When the optional +symbolize_names+ keyword argument is set to a
|
329
|
+
# true value, returns symbols for keys in Hash objects (default: strings).
|
330
|
+
#
|
331
|
+
# Psych.load("---\n foo: bar") # => {"foo"=>"bar"}
|
332
|
+
# Psych.load("---\n foo: bar", symbolize_names: true) # => {:foo=>"bar"}
|
333
|
+
#
|
334
|
+
# Raises a TypeError when `yaml` parameter is NilClass. This method is
|
335
|
+
# similar to `safe_load` except that `Symbol` objects are allowed by default.
|
336
|
+
#
|
337
|
+
# source://psych//psych.rb#368
|
338
|
+
def load(yaml, permitted_classes: T.unsafe(nil), permitted_symbols: T.unsafe(nil), aliases: T.unsafe(nil), filename: T.unsafe(nil), fallback: T.unsafe(nil), symbolize_names: T.unsafe(nil), freeze: T.unsafe(nil), strict_integer: T.unsafe(nil)); end
|
339
|
+
|
340
|
+
# Loads the document contained in +filename+. Returns the yaml contained in
|
341
|
+
# +filename+ as a Ruby object, or if the file is empty, it returns
|
342
|
+
# the specified +fallback+ return value, which defaults to +false+.
|
343
|
+
# See load for options.
|
344
|
+
#
|
345
|
+
# source://psych//psych.rb#669
|
346
|
+
def load_file(filename, **kwargs); end
|
347
|
+
|
348
|
+
# Load multiple documents given in +yaml+. Returns the parsed documents
|
349
|
+
# as a list. If a block is given, each document will be converted to Ruby
|
350
|
+
# and passed to the block during parsing
|
351
|
+
#
|
352
|
+
# Example:
|
353
|
+
#
|
354
|
+
# Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar']
|
355
|
+
#
|
356
|
+
# list = []
|
357
|
+
# Psych.load_stream("--- foo\n...\n--- bar\n...") do |ruby|
|
358
|
+
# list << ruby
|
359
|
+
# end
|
360
|
+
# list # => ['foo', 'bar']
|
361
|
+
#
|
362
|
+
# source://psych//psych.rb#626
|
363
|
+
def load_stream(yaml, filename: T.unsafe(nil), fallback: T.unsafe(nil), **kwargs); end
|
364
|
+
|
365
|
+
# source://psych//psych.rb#712
|
366
|
+
def load_tags; end
|
367
|
+
|
368
|
+
# source://psych//psych.rb#724
|
369
|
+
def load_tags=(value); end
|
370
|
+
|
371
|
+
# Parse a YAML string in +yaml+. Returns the Psych::Nodes::Document.
|
372
|
+
# +filename+ is used in the exception message if a Psych::SyntaxError is
|
373
|
+
# raised.
|
374
|
+
#
|
375
|
+
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
|
376
|
+
#
|
377
|
+
# Example:
|
378
|
+
#
|
379
|
+
# Psych.parse("---\n - a\n - b") # => #<Psych::Nodes::Document:0x00>
|
380
|
+
#
|
381
|
+
# begin
|
382
|
+
# Psych.parse("--- `", filename: "file.txt")
|
383
|
+
# rescue Psych::SyntaxError => ex
|
384
|
+
# ex.file # => 'file.txt'
|
385
|
+
# ex.message # => "(file.txt): found character that cannot start any token"
|
386
|
+
# end
|
387
|
+
#
|
388
|
+
# See Psych::Nodes for more information about YAML AST.
|
389
|
+
#
|
390
|
+
# source://psych//psych.rb#398
|
391
|
+
def parse(yaml, filename: T.unsafe(nil)); end
|
392
|
+
|
393
|
+
# Parse a file at +filename+. Returns the Psych::Nodes::Document.
|
394
|
+
#
|
395
|
+
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
|
396
|
+
#
|
397
|
+
# source://psych//psych.rb#410
|
398
|
+
def parse_file(filename, fallback: T.unsafe(nil)); end
|
399
|
+
|
400
|
+
# Parse a YAML string in +yaml+. Returns the Psych::Nodes::Stream.
|
401
|
+
# This method can handle multiple YAML documents contained in +yaml+.
|
402
|
+
# +filename+ is used in the exception message if a Psych::SyntaxError is
|
403
|
+
# raised.
|
404
|
+
#
|
405
|
+
# If a block is given, a Psych::Nodes::Document node will be yielded to the
|
406
|
+
# block as it's being parsed.
|
407
|
+
#
|
408
|
+
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
|
409
|
+
#
|
410
|
+
# Example:
|
411
|
+
#
|
412
|
+
# Psych.parse_stream("---\n - a\n - b") # => #<Psych::Nodes::Stream:0x00>
|
413
|
+
#
|
414
|
+
# Psych.parse_stream("--- a\n--- b") do |node|
|
415
|
+
# node # => #<Psych::Nodes::Document:0x00>
|
416
|
+
# end
|
417
|
+
#
|
418
|
+
# begin
|
419
|
+
# Psych.parse_stream("--- `", filename: "file.txt")
|
420
|
+
# rescue Psych::SyntaxError => ex
|
421
|
+
# ex.file # => 'file.txt'
|
422
|
+
# ex.message # => "(file.txt): found character that cannot start any token"
|
423
|
+
# end
|
424
|
+
#
|
425
|
+
# Raises a TypeError when NilClass is passed.
|
426
|
+
#
|
427
|
+
# See Psych::Nodes for more information about YAML AST.
|
428
|
+
#
|
429
|
+
# source://psych//psych.rb#452
|
430
|
+
def parse_stream(yaml, filename: T.unsafe(nil), &block); end
|
431
|
+
|
432
|
+
# Returns a default parser
|
433
|
+
#
|
434
|
+
# source://psych//psych.rb#419
|
435
|
+
def parser; end
|
436
|
+
|
437
|
+
# source://psych//psych.rb#688
|
438
|
+
def remove_type(type_tag); end
|
439
|
+
|
440
|
+
# call-seq:
|
441
|
+
# Psych.safe_dump(o) -> string of yaml
|
442
|
+
# Psych.safe_dump(o, options) -> string of yaml
|
443
|
+
# Psych.safe_dump(o, io) -> io object passed in
|
444
|
+
# Psych.safe_dump(o, io, options) -> io object passed in
|
445
|
+
#
|
446
|
+
# Safely dump Ruby object +o+ to a YAML string. Optional +options+ may be passed in
|
447
|
+
# to control the output format. If an IO object is passed in, the YAML will
|
448
|
+
# be dumped to that IO object. By default, only the following
|
449
|
+
# classes are allowed to be serialized:
|
450
|
+
#
|
451
|
+
# * TrueClass
|
452
|
+
# * FalseClass
|
453
|
+
# * NilClass
|
454
|
+
# * Integer
|
455
|
+
# * Float
|
456
|
+
# * String
|
457
|
+
# * Array
|
458
|
+
# * Hash
|
459
|
+
#
|
460
|
+
# Arbitrary classes can be allowed by adding those classes to the +permitted_classes+
|
461
|
+
# keyword argument. They are additive. For example, to allow Date serialization:
|
462
|
+
#
|
463
|
+
# Psych.safe_dump(yaml, permitted_classes: [Date])
|
464
|
+
#
|
465
|
+
# Now the Date class can be dumped in addition to the classes listed above.
|
466
|
+
#
|
467
|
+
# A Psych::DisallowedClass exception will be raised if the object contains a
|
468
|
+
# class that isn't in the +permitted_classes+ list.
|
469
|
+
#
|
470
|
+
# Currently supported options are:
|
471
|
+
#
|
472
|
+
# [<tt>:indentation</tt>] Number of space characters used to indent.
|
473
|
+
# Acceptable value should be in <tt>0..9</tt> range,
|
474
|
+
# otherwise option is ignored.
|
475
|
+
#
|
476
|
+
# Default: <tt>2</tt>.
|
477
|
+
# [<tt>:line_width</tt>] Max character to wrap line at.
|
478
|
+
#
|
479
|
+
# Default: <tt>0</tt> (meaning "wrap at 81").
|
480
|
+
# [<tt>:canonical</tt>] Write "canonical" YAML form (very verbose, yet
|
481
|
+
# strictly formal).
|
482
|
+
#
|
483
|
+
# Default: <tt>false</tt>.
|
484
|
+
# [<tt>:header</tt>] Write <tt>%YAML [version]</tt> at the beginning of document.
|
485
|
+
#
|
486
|
+
# Default: <tt>false</tt>.
|
487
|
+
#
|
488
|
+
# Example:
|
489
|
+
#
|
490
|
+
# # Dump an array, get back a YAML string
|
491
|
+
# Psych.safe_dump(['a', 'b']) # => "---\n- a\n- b\n"
|
492
|
+
#
|
493
|
+
# # Dump an array to an IO object
|
494
|
+
# Psych.safe_dump(['a', 'b'], StringIO.new) # => #<StringIO:0x000001009d0890>
|
495
|
+
#
|
496
|
+
# # Dump an array with indentation set
|
497
|
+
# Psych.safe_dump(['a', ['b']], indentation: 3) # => "---\n- a\n- - b\n"
|
498
|
+
#
|
499
|
+
# # Dump an array to an IO with indentation set
|
500
|
+
# Psych.safe_dump(['a', ['b']], StringIO.new, indentation: 3)
|
501
|
+
#
|
502
|
+
# source://psych//psych.rb#578
|
503
|
+
def safe_dump(o, io = T.unsafe(nil), options = T.unsafe(nil)); end
|
504
|
+
|
505
|
+
# Safely load the yaml string in +yaml+. By default, only the following
|
506
|
+
# classes are allowed to be deserialized:
|
507
|
+
#
|
508
|
+
# * TrueClass
|
509
|
+
# * FalseClass
|
510
|
+
# * NilClass
|
511
|
+
# * Integer
|
512
|
+
# * Float
|
513
|
+
# * String
|
514
|
+
# * Array
|
515
|
+
# * Hash
|
516
|
+
#
|
517
|
+
# Recursive data structures are not allowed by default. Arbitrary classes
|
518
|
+
# can be allowed by adding those classes to the +permitted_classes+ keyword argument. They are
|
519
|
+
# additive. For example, to allow Date deserialization:
|
520
|
+
#
|
521
|
+
# Psych.safe_load(yaml, permitted_classes: [Date])
|
522
|
+
#
|
523
|
+
# Now the Date class can be loaded in addition to the classes listed above.
|
524
|
+
#
|
525
|
+
# Aliases can be explicitly allowed by changing the +aliases+ keyword argument.
|
526
|
+
# For example:
|
527
|
+
#
|
528
|
+
# x = []
|
529
|
+
# x << x
|
530
|
+
# yaml = Psych.dump x
|
531
|
+
# Psych.safe_load yaml # => raises an exception
|
532
|
+
# Psych.safe_load yaml, aliases: true # => loads the aliases
|
533
|
+
#
|
534
|
+
# A Psych::DisallowedClass exception will be raised if the yaml contains a
|
535
|
+
# class that isn't in the +permitted_classes+ list.
|
536
|
+
#
|
537
|
+
# A Psych::AliasesNotEnabled exception will be raised if the yaml contains aliases
|
538
|
+
# but the +aliases+ keyword argument is set to false.
|
539
|
+
#
|
540
|
+
# +filename+ will be used in the exception message if any exception is raised
|
541
|
+
# while parsing.
|
542
|
+
#
|
543
|
+
# When the optional +symbolize_names+ keyword argument is set to a
|
544
|
+
# true value, returns symbols for keys in Hash objects (default: strings).
|
545
|
+
#
|
546
|
+
# Psych.safe_load("---\n foo: bar") # => {"foo"=>"bar"}
|
547
|
+
# Psych.safe_load("---\n foo: bar", symbolize_names: true) # => {:foo=>"bar"}
|
548
|
+
#
|
549
|
+
# source://psych//psych.rb#322
|
550
|
+
def safe_load(yaml, permitted_classes: T.unsafe(nil), permitted_symbols: T.unsafe(nil), aliases: T.unsafe(nil), filename: T.unsafe(nil), fallback: T.unsafe(nil), symbolize_names: T.unsafe(nil), freeze: T.unsafe(nil), strict_integer: T.unsafe(nil)); end
|
551
|
+
|
552
|
+
# Safely loads the document contained in +filename+. Returns the yaml contained in
|
553
|
+
# +filename+ as a Ruby object, or if the file is empty, it returns
|
554
|
+
# the specified +fallback+ return value, which defaults to +false+.
|
555
|
+
# See safe_load for options.
|
556
|
+
#
|
557
|
+
# source://psych//psych.rb#658
|
558
|
+
def safe_load_file(filename, **kwargs); end
|
559
|
+
|
560
|
+
# Dump Ruby +object+ to a JSON string.
|
561
|
+
#
|
562
|
+
# source://psych//psych.rb#605
|
563
|
+
def to_json(object); end
|
564
|
+
|
565
|
+
# Load +yaml+ in to a Ruby data structure. If multiple documents are
|
566
|
+
# provided, the object contained in the first document will be returned.
|
567
|
+
# +filename+ will be used in the exception message if any exception
|
568
|
+
# is raised while parsing. If +yaml+ is empty, it returns
|
569
|
+
# the specified +fallback+ return value, which defaults to +false+.
|
570
|
+
#
|
571
|
+
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
|
572
|
+
#
|
573
|
+
# Example:
|
574
|
+
#
|
575
|
+
# Psych.unsafe_load("--- a") # => 'a'
|
576
|
+
# Psych.unsafe_load("---\n - a\n - b") # => ['a', 'b']
|
577
|
+
#
|
578
|
+
# begin
|
579
|
+
# Psych.unsafe_load("--- `", filename: "file.txt")
|
580
|
+
# rescue Psych::SyntaxError => ex
|
581
|
+
# ex.file # => 'file.txt'
|
582
|
+
# ex.message # => "(file.txt): found character that cannot start any token"
|
583
|
+
# end
|
584
|
+
#
|
585
|
+
# When the optional +symbolize_names+ keyword argument is set to a
|
586
|
+
# true value, returns symbols for keys in Hash objects (default: strings).
|
587
|
+
#
|
588
|
+
# Psych.unsafe_load("---\n foo: bar") # => {"foo"=>"bar"}
|
589
|
+
# Psych.unsafe_load("---\n foo: bar", symbolize_names: true) # => {:foo=>"bar"}
|
590
|
+
#
|
591
|
+
# Raises a TypeError when `yaml` parameter is NilClass
|
592
|
+
#
|
593
|
+
# NOTE: This method *should not* be used to parse untrusted documents, such as
|
594
|
+
# YAML documents that are supplied via user input. Instead, please use the
|
595
|
+
# load method or the safe_load method.
|
596
|
+
#
|
597
|
+
# source://psych//psych.rb#271
|
598
|
+
def unsafe_load(yaml, filename: T.unsafe(nil), fallback: T.unsafe(nil), symbolize_names: T.unsafe(nil), freeze: T.unsafe(nil), strict_integer: T.unsafe(nil)); end
|
599
|
+
|
600
|
+
# Load the document contained in +filename+. Returns the yaml contained in
|
601
|
+
# +filename+ as a Ruby object, or if the file is empty, it returns
|
602
|
+
# the specified +fallback+ return value, which defaults to +false+.
|
603
|
+
#
|
604
|
+
# NOTE: This method *should not* be used to parse untrusted documents, such as
|
605
|
+
# YAML documents that are supplied via user input. Instead, please use the
|
606
|
+
# safe_load_file method.
|
607
|
+
#
|
608
|
+
# source://psych//psych.rb#647
|
609
|
+
def unsafe_load_file(filename, **kwargs); end
|
610
|
+
end
|
611
|
+
end
|
612
|
+
|
613
|
+
# Subclasses `BadAlias` for backwards compatibility
|
614
|
+
class Psych::AliasesNotEnabled < ::Psych::BadAlias
|
615
|
+
# @return [AliasesNotEnabled] a new instance of AliasesNotEnabled
|
616
|
+
#
|
617
|
+
# source://psych//psych/exception.rb#11
|
618
|
+
def initialize; end
|
619
|
+
end
|
620
|
+
|
621
|
+
# Subclasses `BadAlias` for backwards compatibility
|
622
|
+
class Psych::AnchorNotDefined < ::Psych::BadAlias
|
623
|
+
# @return [AnchorNotDefined] a new instance of AnchorNotDefined
|
624
|
+
#
|
625
|
+
# source://psych//psych/exception.rb#18
|
626
|
+
def initialize(anchor_name); end
|
627
|
+
end
|
628
|
+
|
629
|
+
class Psych::ClassLoader
|
630
|
+
# @return [ClassLoader] a new instance of ClassLoader
|
631
|
+
#
|
632
|
+
# source://psych//psych/class_loader.rb#21
|
633
|
+
def initialize; end
|
634
|
+
|
635
|
+
# source://psych//psych/class_loader.rb#39
|
636
|
+
def big_decimal; end
|
637
|
+
|
638
|
+
# source://psych//psych/class_loader.rb#39
|
639
|
+
def complex; end
|
640
|
+
|
641
|
+
# source://psych//psych/class_loader.rb#39
|
642
|
+
def date; end
|
643
|
+
|
644
|
+
# source://psych//psych/class_loader.rb#39
|
645
|
+
def date_time; end
|
646
|
+
|
647
|
+
# source://psych//psych/class_loader.rb#39
|
648
|
+
def exception; end
|
649
|
+
|
650
|
+
# source://psych//psych/class_loader.rb#25
|
651
|
+
def load(klassname); end
|
652
|
+
|
653
|
+
# source://psych//psych/class_loader.rb#39
|
654
|
+
def object; end
|
655
|
+
|
656
|
+
# source://psych//psych/class_loader.rb#39
|
657
|
+
def psych_omap; end
|
658
|
+
|
659
|
+
# source://psych//psych/class_loader.rb#39
|
660
|
+
def psych_set; end
|
661
|
+
|
662
|
+
# source://psych//psych/class_loader.rb#39
|
663
|
+
def range; end
|
664
|
+
|
665
|
+
# source://psych//psych/class_loader.rb#39
|
666
|
+
def rational; end
|
667
|
+
|
668
|
+
# source://psych//psych/class_loader.rb#39
|
669
|
+
def regexp; end
|
670
|
+
|
671
|
+
# source://psych//psych/class_loader.rb#39
|
672
|
+
def struct; end
|
673
|
+
|
674
|
+
# source://psych//psych/class_loader.rb#39
|
675
|
+
def symbol; end
|
676
|
+
|
677
|
+
# source://psych//psych/class_loader.rb#31
|
678
|
+
def symbolize(sym); end
|
679
|
+
|
680
|
+
private
|
681
|
+
|
682
|
+
# source://psych//psych/class_loader.rb#47
|
683
|
+
def find(klassname); end
|
684
|
+
|
685
|
+
# source://psych//psych/class_loader.rb#51
|
686
|
+
def resolve(klassname); end
|
687
|
+
end
|
688
|
+
|
689
|
+
class Psych::ClassLoader::Restricted < ::Psych::ClassLoader
|
690
|
+
# @return [Restricted] a new instance of Restricted
|
691
|
+
#
|
692
|
+
# source://psych//psych/class_loader.rb#77
|
693
|
+
def initialize(classes, symbols); end
|
694
|
+
|
695
|
+
# source://psych//psych/class_loader.rb#83
|
696
|
+
def symbolize(sym); end
|
697
|
+
|
698
|
+
private
|
699
|
+
|
700
|
+
# source://psych//psych/class_loader.rb#95
|
701
|
+
def find(klassname); end
|
702
|
+
end
|
703
|
+
|
704
|
+
# If an object defines +encode_with+, then an instance of Psych::Coder will
|
705
|
+
# be passed to the method when the object is being serialized. The Coder
|
706
|
+
# automatically assumes a Psych::Nodes::Mapping is being emitted. Other
|
707
|
+
# objects like Sequence and Scalar may be emitted if +seq=+ or +scalar=+ are
|
708
|
+
# called, respectively.
|
709
|
+
class Psych::Coder
|
710
|
+
# @return [Coder] a new instance of Coder
|
711
|
+
#
|
712
|
+
# source://psych//psych/coder.rb#13
|
713
|
+
def initialize(tag); end
|
714
|
+
|
715
|
+
# source://psych//psych/coder.rb#84
|
716
|
+
def [](k); end
|
717
|
+
|
718
|
+
# source://psych//psych/coder.rb#78
|
719
|
+
def []=(k, v); end
|
720
|
+
|
721
|
+
# source://psych//psych/coder.rb#78
|
722
|
+
def add(k, v); end
|
723
|
+
|
724
|
+
# Returns the value of attribute implicit.
|
725
|
+
#
|
726
|
+
# source://psych//psych/coder.rb#10
|
727
|
+
def implicit; end
|
728
|
+
|
729
|
+
# Sets the attribute implicit
|
730
|
+
#
|
731
|
+
# @param value the value to set the attribute implicit to.
|
732
|
+
#
|
733
|
+
# source://psych//psych/coder.rb#10
|
734
|
+
def implicit=(_arg0); end
|
735
|
+
|
736
|
+
# Emit a map. The coder will be yielded to the block.
|
737
|
+
#
|
738
|
+
# @yield [_self]
|
739
|
+
# @yieldparam _self [Psych::Coder] the object that the method was called on
|
740
|
+
#
|
741
|
+
# source://psych//psych/coder.rb#34
|
742
|
+
def map(tag = T.unsafe(nil), style = T.unsafe(nil)); end
|
743
|
+
|
744
|
+
# Emit a map with +value+
|
745
|
+
#
|
746
|
+
# source://psych//psych/coder.rb#73
|
747
|
+
def map=(map); end
|
748
|
+
|
749
|
+
# Returns the value of attribute object.
|
750
|
+
#
|
751
|
+
# source://psych//psych/coder.rb#10
|
752
|
+
def object; end
|
753
|
+
|
754
|
+
# Sets the attribute object
|
755
|
+
#
|
756
|
+
# @param value the value to set the attribute object to.
|
757
|
+
#
|
758
|
+
# source://psych//psych/coder.rb#10
|
759
|
+
def object=(_arg0); end
|
760
|
+
|
761
|
+
# Emit a sequence with +map+ and +tag+
|
762
|
+
#
|
763
|
+
# source://psych//psych/coder.rb#54
|
764
|
+
def represent_map(tag, map); end
|
765
|
+
|
766
|
+
# Emit an arbitrary object +obj+ and +tag+
|
767
|
+
#
|
768
|
+
# source://psych//psych/coder.rb#60
|
769
|
+
def represent_object(tag, obj); end
|
770
|
+
|
771
|
+
# Emit a scalar with +value+ and +tag+
|
772
|
+
#
|
773
|
+
# source://psych//psych/coder.rb#42
|
774
|
+
def represent_scalar(tag, value); end
|
775
|
+
|
776
|
+
# Emit a sequence with +list+ and +tag+
|
777
|
+
#
|
778
|
+
# source://psych//psych/coder.rb#48
|
779
|
+
def represent_seq(tag, list); end
|
780
|
+
|
781
|
+
# source://psych//psych/coder.rb#24
|
782
|
+
def scalar(*args); end
|
783
|
+
|
784
|
+
# Emit a scalar with +value+
|
785
|
+
#
|
786
|
+
# source://psych//psych/coder.rb#67
|
787
|
+
def scalar=(value); end
|
788
|
+
|
789
|
+
# Returns the value of attribute seq.
|
790
|
+
#
|
791
|
+
# source://psych//psych/coder.rb#11
|
792
|
+
def seq; end
|
793
|
+
|
794
|
+
# Emit a sequence of +list+
|
795
|
+
#
|
796
|
+
# source://psych//psych/coder.rb#90
|
797
|
+
def seq=(list); end
|
798
|
+
|
799
|
+
# Returns the value of attribute style.
|
800
|
+
#
|
801
|
+
# source://psych//psych/coder.rb#10
|
802
|
+
def style; end
|
803
|
+
|
804
|
+
# Sets the attribute style
|
805
|
+
#
|
806
|
+
# @param value the value to set the attribute style to.
|
807
|
+
#
|
808
|
+
# source://psych//psych/coder.rb#10
|
809
|
+
def style=(_arg0); end
|
810
|
+
|
811
|
+
# Returns the value of attribute tag.
|
812
|
+
#
|
813
|
+
# source://psych//psych/coder.rb#10
|
814
|
+
def tag; end
|
815
|
+
|
816
|
+
# Sets the attribute tag
|
817
|
+
#
|
818
|
+
# @param value the value to set the attribute tag to.
|
819
|
+
#
|
820
|
+
# source://psych//psych/coder.rb#10
|
821
|
+
def tag=(_arg0); end
|
822
|
+
|
823
|
+
# Returns the value of attribute type.
|
824
|
+
#
|
825
|
+
# source://psych//psych/coder.rb#11
|
826
|
+
def type; end
|
827
|
+
end
|
828
|
+
|
829
|
+
class Psych::DisallowedClass < ::Psych::Exception
|
830
|
+
# @return [DisallowedClass] a new instance of DisallowedClass
|
831
|
+
#
|
832
|
+
# source://psych//psych/exception.rb#24
|
833
|
+
def initialize(action, klass_name); end
|
834
|
+
end
|
835
|
+
|
836
|
+
# Psych::Handler is an abstract base class that defines the events used
|
837
|
+
# when dealing with Psych::Parser. Clients who want to use Psych::Parser
|
838
|
+
# should implement a class that inherits from Psych::Handler and define
|
839
|
+
# events that they can handle.
|
840
|
+
#
|
841
|
+
# Psych::Handler defines all events that Psych::Parser can possibly send to
|
842
|
+
# event handlers.
|
843
|
+
#
|
844
|
+
# See Psych::Parser for more details
|
845
|
+
class Psych::Handler
|
846
|
+
# Called when an alias is found to +anchor+. +anchor+ will be the name
|
847
|
+
# of the anchor found.
|
848
|
+
#
|
849
|
+
# === Example
|
850
|
+
#
|
851
|
+
# Here we have an example of an array that references itself in YAML:
|
852
|
+
#
|
853
|
+
# --- &ponies
|
854
|
+
# - first element
|
855
|
+
# - *ponies
|
856
|
+
#
|
857
|
+
# &ponies is the anchor, *ponies is the alias. In this case, alias is
|
858
|
+
# called with "ponies".
|
859
|
+
#
|
860
|
+
# source://psych//psych/handler.rb#110
|
861
|
+
def alias(anchor); end
|
862
|
+
|
863
|
+
# Called when an empty event happens. (Which, as far as I can tell, is
|
864
|
+
# never).
|
865
|
+
#
|
866
|
+
# source://psych//psych/handler.rb#236
|
867
|
+
def empty; end
|
868
|
+
|
869
|
+
# Called with the document ends. +implicit+ is a boolean value indicating
|
870
|
+
# whether or not the document has an implicit ending.
|
871
|
+
#
|
872
|
+
# === Example
|
873
|
+
#
|
874
|
+
# Given the following YAML:
|
875
|
+
#
|
876
|
+
# ---
|
877
|
+
# hello world
|
878
|
+
#
|
879
|
+
# +implicit+ will be true. Given this YAML:
|
880
|
+
#
|
881
|
+
# ---
|
882
|
+
# hello world
|
883
|
+
# ...
|
884
|
+
#
|
885
|
+
# +implicit+ will be false.
|
886
|
+
#
|
887
|
+
# source://psych//psych/handler.rb#93
|
888
|
+
def end_document(implicit); end
|
889
|
+
|
890
|
+
# Called when a map ends
|
891
|
+
#
|
892
|
+
# source://psych//psych/handler.rb#230
|
893
|
+
def end_mapping; end
|
894
|
+
|
895
|
+
# Called when a sequence ends.
|
896
|
+
#
|
897
|
+
# source://psych//psych/handler.rb#191
|
898
|
+
def end_sequence; end
|
899
|
+
|
900
|
+
# Called when the YAML stream ends
|
901
|
+
#
|
902
|
+
# source://psych//psych/handler.rb#241
|
903
|
+
def end_stream; end
|
904
|
+
|
905
|
+
# Called before each event with line/column information.
|
906
|
+
#
|
907
|
+
# source://psych//psych/handler.rb#246
|
908
|
+
def event_location(start_line, start_column, end_line, end_column); end
|
909
|
+
|
910
|
+
# Called when a scalar +value+ is found. The scalar may have an
|
911
|
+
# +anchor+, a +tag+, be implicitly +plain+ or implicitly +quoted+
|
912
|
+
#
|
913
|
+
# +value+ is the string value of the scalar
|
914
|
+
# +anchor+ is an associated anchor or nil
|
915
|
+
# +tag+ is an associated tag or nil
|
916
|
+
# +plain+ is a boolean value
|
917
|
+
# +quoted+ is a boolean value
|
918
|
+
# +style+ is an integer indicating the string style
|
919
|
+
#
|
920
|
+
# See the constants in Psych::Nodes::Scalar for the possible values of
|
921
|
+
# +style+
|
922
|
+
#
|
923
|
+
# === Example
|
924
|
+
#
|
925
|
+
# Here is a YAML document that exercises most of the possible ways this
|
926
|
+
# method can be called:
|
927
|
+
#
|
928
|
+
# ---
|
929
|
+
# - !str "foo"
|
930
|
+
# - &anchor fun
|
931
|
+
# - many
|
932
|
+
# lines
|
933
|
+
# - |
|
934
|
+
# many
|
935
|
+
# newlines
|
936
|
+
#
|
937
|
+
# The above YAML document contains a list with four strings. Here are
|
938
|
+
# the parameters sent to this method in the same order:
|
939
|
+
#
|
940
|
+
# # value anchor tag plain quoted style
|
941
|
+
# ["foo", nil, "!str", false, false, 3 ]
|
942
|
+
# ["fun", "anchor", nil, true, false, 1 ]
|
943
|
+
# ["many lines", nil, nil, true, false, 1 ]
|
944
|
+
# ["many\nnewlines\n", nil, nil, false, true, 4 ]
|
945
|
+
#
|
946
|
+
# source://psych//psych/handler.rb#150
|
947
|
+
def scalar(value, anchor, tag, plain, quoted, style); end
|
948
|
+
|
949
|
+
# Called when the document starts with the declared +version+,
|
950
|
+
# +tag_directives+, if the document is +implicit+.
|
951
|
+
#
|
952
|
+
# +version+ will be an array of integers indicating the YAML version being
|
953
|
+
# dealt with, +tag_directives+ is a list of tuples indicating the prefix
|
954
|
+
# and suffix of each tag, and +implicit+ is a boolean indicating whether
|
955
|
+
# the document is started implicitly.
|
956
|
+
#
|
957
|
+
# === Example
|
958
|
+
#
|
959
|
+
# Given the following YAML:
|
960
|
+
#
|
961
|
+
# %YAML 1.1
|
962
|
+
# %TAG ! tag:tenderlovemaking.com,2009:
|
963
|
+
# --- !squee
|
964
|
+
#
|
965
|
+
# The parameters for start_document must be this:
|
966
|
+
#
|
967
|
+
# version # => [1, 1]
|
968
|
+
# tag_directives # => [["!", "tag:tenderlovemaking.com,2009:"]]
|
969
|
+
# implicit # => false
|
970
|
+
#
|
971
|
+
# source://psych//psych/handler.rb#72
|
972
|
+
def start_document(version, tag_directives, implicit); end
|
973
|
+
|
974
|
+
# Called when a map starts.
|
975
|
+
#
|
976
|
+
# +anchor+ is the anchor associated with the map or +nil+.
|
977
|
+
# +tag+ is the tag associated with the map or +nil+.
|
978
|
+
# +implicit+ is a boolean indicating whether or not the map was implicitly
|
979
|
+
# started.
|
980
|
+
# +style+ is an integer indicating the mapping style.
|
981
|
+
#
|
982
|
+
# See the constants in Psych::Nodes::Mapping for the possible values of
|
983
|
+
# +style+.
|
984
|
+
#
|
985
|
+
# === Example
|
986
|
+
#
|
987
|
+
# Here is a YAML document that exercises most of the possible ways this
|
988
|
+
# method can be called:
|
989
|
+
#
|
990
|
+
# ---
|
991
|
+
# k: !!map { hello: world }
|
992
|
+
# v: &pewpew
|
993
|
+
# hello: world
|
994
|
+
#
|
995
|
+
# The above YAML document consists of three maps, an outer map that contains
|
996
|
+
# two inner maps. Below is a matrix of the parameters sent in order to
|
997
|
+
# represent these three maps:
|
998
|
+
#
|
999
|
+
# # anchor tag implicit style
|
1000
|
+
# [nil, nil, true, 1 ]
|
1001
|
+
# [nil, "tag:yaml.org,2002:map", false, 2 ]
|
1002
|
+
# ["pewpew", nil, true, 1 ]
|
1003
|
+
#
|
1004
|
+
# source://psych//psych/handler.rb#225
|
1005
|
+
def start_mapping(anchor, tag, implicit, style); end
|
1006
|
+
|
1007
|
+
# Called when a sequence is started.
|
1008
|
+
#
|
1009
|
+
# +anchor+ is the anchor associated with the sequence or nil.
|
1010
|
+
# +tag+ is the tag associated with the sequence or nil.
|
1011
|
+
# +implicit+ a boolean indicating whether or not the sequence was implicitly
|
1012
|
+
# started.
|
1013
|
+
# +style+ is an integer indicating the list style.
|
1014
|
+
#
|
1015
|
+
# See the constants in Psych::Nodes::Sequence for the possible values of
|
1016
|
+
# +style+.
|
1017
|
+
#
|
1018
|
+
# === Example
|
1019
|
+
#
|
1020
|
+
# Here is a YAML document that exercises most of the possible ways this
|
1021
|
+
# method can be called:
|
1022
|
+
#
|
1023
|
+
# ---
|
1024
|
+
# - !!seq [
|
1025
|
+
# a
|
1026
|
+
# ]
|
1027
|
+
# - &pewpew
|
1028
|
+
# - b
|
1029
|
+
#
|
1030
|
+
# The above YAML document consists of three lists, an outer list that
|
1031
|
+
# contains two inner lists. Here is a matrix of the parameters sent
|
1032
|
+
# to represent these lists:
|
1033
|
+
#
|
1034
|
+
# # anchor tag implicit style
|
1035
|
+
# [nil, nil, true, 1 ]
|
1036
|
+
# [nil, "tag:yaml.org,2002:seq", false, 2 ]
|
1037
|
+
# ["pewpew", nil, true, 1 ]
|
1038
|
+
#
|
1039
|
+
# source://psych//psych/handler.rb#186
|
1040
|
+
def start_sequence(anchor, tag, implicit, style); end
|
1041
|
+
|
1042
|
+
# Called with +encoding+ when the YAML stream starts. This method is
|
1043
|
+
# called once per stream. A stream may contain multiple documents.
|
1044
|
+
#
|
1045
|
+
# See the constants in Psych::Parser for the possible values of +encoding+.
|
1046
|
+
#
|
1047
|
+
# source://psych//psych/handler.rb#47
|
1048
|
+
def start_stream(encoding); end
|
1049
|
+
|
1050
|
+
# Is this handler a streaming handler?
|
1051
|
+
#
|
1052
|
+
# @return [Boolean]
|
1053
|
+
#
|
1054
|
+
# source://psych//psych/handler.rb#251
|
1055
|
+
def streaming?; end
|
1056
|
+
end
|
1057
|
+
|
1058
|
+
# Configuration options for dumping YAML.
|
1059
|
+
class Psych::Handler::DumperOptions
|
1060
|
+
# @return [DumperOptions] a new instance of DumperOptions
|
1061
|
+
#
|
1062
|
+
# source://psych//psych/handler.rb#19
|
1063
|
+
def initialize; end
|
1064
|
+
|
1065
|
+
# Returns the value of attribute canonical.
|
1066
|
+
#
|
1067
|
+
# source://psych//psych/handler.rb#17
|
1068
|
+
def canonical; end
|
1069
|
+
|
1070
|
+
# Sets the attribute canonical
|
1071
|
+
#
|
1072
|
+
# @param value the value to set the attribute canonical to.
|
1073
|
+
#
|
1074
|
+
# source://psych//psych/handler.rb#17
|
1075
|
+
def canonical=(_arg0); end
|
1076
|
+
|
1077
|
+
# Returns the value of attribute indentation.
|
1078
|
+
#
|
1079
|
+
# source://psych//psych/handler.rb#17
|
1080
|
+
def indentation; end
|
1081
|
+
|
1082
|
+
# Sets the attribute indentation
|
1083
|
+
#
|
1084
|
+
# @param value the value to set the attribute indentation to.
|
1085
|
+
#
|
1086
|
+
# source://psych//psych/handler.rb#17
|
1087
|
+
def indentation=(_arg0); end
|
1088
|
+
|
1089
|
+
# Returns the value of attribute line_width.
|
1090
|
+
#
|
1091
|
+
# source://psych//psych/handler.rb#17
|
1092
|
+
def line_width; end
|
1093
|
+
|
1094
|
+
# Sets the attribute line_width
|
1095
|
+
#
|
1096
|
+
# @param value the value to set the attribute line_width to.
|
1097
|
+
#
|
1098
|
+
# source://psych//psych/handler.rb#17
|
1099
|
+
def line_width=(_arg0); end
|
1100
|
+
end
|
1101
|
+
|
1102
|
+
class Psych::JSON::Stream < ::Psych::Visitors::JSONTree
|
1103
|
+
include ::Psych::Streaming
|
1104
|
+
extend ::Psych::Streaming::ClassMethods
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
# YAML event parser class. This class parses a YAML document and calls
|
1108
|
+
# events on the handler that is passed to the constructor. The events can
|
1109
|
+
# be used for things such as constructing a YAML AST or deserializing YAML
|
1110
|
+
# documents. It can even be fed back to Psych::Emitter to emit the same
|
1111
|
+
# document that was parsed.
|
1112
|
+
#
|
1113
|
+
# See Psych::Handler for documentation on the events that Psych::Parser emits.
|
1114
|
+
#
|
1115
|
+
# Here is an example that prints out ever scalar found in a YAML document:
|
1116
|
+
#
|
1117
|
+
# # Handler for detecting scalar values
|
1118
|
+
# class ScalarHandler < Psych::Handler
|
1119
|
+
# def scalar value, anchor, tag, plain, quoted, style
|
1120
|
+
# puts value
|
1121
|
+
# end
|
1122
|
+
# end
|
1123
|
+
#
|
1124
|
+
# parser = Psych::Parser.new(ScalarHandler.new)
|
1125
|
+
# parser.parse(yaml_document)
|
1126
|
+
#
|
1127
|
+
# Here is an example that feeds the parser back in to Psych::Emitter. The
|
1128
|
+
# YAML document is read from STDIN and written back out to STDERR:
|
1129
|
+
#
|
1130
|
+
# parser = Psych::Parser.new(Psych::Emitter.new($stderr))
|
1131
|
+
# parser.parse($stdin)
|
1132
|
+
#
|
1133
|
+
# Psych uses Psych::Parser in combination with Psych::TreeBuilder to
|
1134
|
+
# construct an AST of the parsed YAML document.
|
1135
|
+
class Psych::Parser
|
1136
|
+
# Creates a new Psych::Parser instance with +handler+. YAML events will
|
1137
|
+
# be called on +handler+. See Psych::Parser for more details.
|
1138
|
+
#
|
1139
|
+
# @return [Parser] a new instance of Parser
|
1140
|
+
#
|
1141
|
+
# source://psych//psych/parser.rb#47
|
1142
|
+
def initialize(handler = T.unsafe(nil)); end
|
1143
|
+
|
1144
|
+
# Set the encoding for this parser to +encoding+
|
1145
|
+
#
|
1146
|
+
# source://psych//psych/parser.rb#41
|
1147
|
+
def external_encoding=(_arg0); end
|
1148
|
+
|
1149
|
+
# The handler on which events will be called
|
1150
|
+
#
|
1151
|
+
# source://psych//psych/parser.rb#38
|
1152
|
+
def handler; end
|
1153
|
+
|
1154
|
+
# The handler on which events will be called
|
1155
|
+
#
|
1156
|
+
# source://psych//psych/parser.rb#38
|
1157
|
+
def handler=(_arg0); end
|
1158
|
+
|
1159
|
+
# call-seq:
|
1160
|
+
# parser.parse(yaml)
|
1161
|
+
#
|
1162
|
+
# Parse the YAML document contained in +yaml+. Events will be called on
|
1163
|
+
# the handler set on the parser instance.
|
1164
|
+
#
|
1165
|
+
# See Psych::Parser and Psych::Parser#handler
|
1166
|
+
#
|
1167
|
+
# source://psych//psych/parser.rb#61
|
1168
|
+
def parse(yaml, path = T.unsafe(nil)); end
|
1169
|
+
end
|
1170
|
+
|
1171
|
+
# Scan scalars for built in types
|
1172
|
+
class Psych::ScalarScanner
|
1173
|
+
# Create a new scanner
|
1174
|
+
#
|
1175
|
+
# @return [ScalarScanner] a new instance of ScalarScanner
|
1176
|
+
#
|
1177
|
+
# source://psych//psych/scalar_scanner.rb#30
|
1178
|
+
def initialize(class_loader, strict_integer: T.unsafe(nil)); end
|
1179
|
+
|
1180
|
+
# Returns the value of attribute class_loader.
|
1181
|
+
#
|
1182
|
+
# source://psych//psych/scalar_scanner.rb#27
|
1183
|
+
def class_loader; end
|
1184
|
+
|
1185
|
+
# Parse and return an int from +string+
|
1186
|
+
#
|
1187
|
+
# source://psych//psych/scalar_scanner.rb#109
|
1188
|
+
def parse_int(string); end
|
1189
|
+
|
1190
|
+
# Parse and return a Time from +string+
|
1191
|
+
#
|
1192
|
+
# source://psych//psych/scalar_scanner.rb#115
|
1193
|
+
def parse_time(string); end
|
1194
|
+
|
1195
|
+
# Tokenize +string+ returning the Ruby object
|
1196
|
+
#
|
1197
|
+
# source://psych//psych/scalar_scanner.rb#37
|
1198
|
+
def tokenize(string); end
|
1199
|
+
end
|
1200
|
+
|
1201
|
+
# Same as above, but allows commas.
|
1202
|
+
# Not to YML spec, but kept for backwards compatibility
|
1203
|
+
#
|
1204
|
+
# source://psych//psych/scalar_scanner.rb#22
|
1205
|
+
Psych::ScalarScanner::INTEGER_LEGACY = T.let(T.unsafe(nil), Regexp)
|
1206
|
+
|
1207
|
+
# Taken from http://yaml.org/type/int.html
|
1208
|
+
#
|
1209
|
+
# source://psych//psych/scalar_scanner.rb#15
|
1210
|
+
Psych::ScalarScanner::INTEGER_STRICT = T.let(T.unsafe(nil), Regexp)
|
1211
|
+
|
1212
|
+
# Psych::Stream is a streaming YAML emitter. It will not buffer your YAML,
|
1213
|
+
# but send it straight to an IO.
|
1214
|
+
#
|
1215
|
+
# Here is an example use:
|
1216
|
+
#
|
1217
|
+
# stream = Psych::Stream.new($stdout)
|
1218
|
+
# stream.start
|
1219
|
+
# stream.push({:foo => 'bar'})
|
1220
|
+
# stream.finish
|
1221
|
+
#
|
1222
|
+
# YAML will be immediately emitted to $stdout with no buffering.
|
1223
|
+
#
|
1224
|
+
# Psych::Stream#start will take a block and ensure that Psych::Stream#finish
|
1225
|
+
# is called, so you can do this form:
|
1226
|
+
#
|
1227
|
+
# stream = Psych::Stream.new($stdout)
|
1228
|
+
# stream.start do |em|
|
1229
|
+
# em.push(:foo => 'bar')
|
1230
|
+
# end
|
1231
|
+
class Psych::Stream < ::Psych::Visitors::YAMLTree
|
1232
|
+
include ::Psych::Streaming
|
1233
|
+
extend ::Psych::Streaming::ClassMethods
|
1234
|
+
end
|
1235
|
+
|
1236
|
+
class Psych::Stream::Emitter < ::Psych::Emitter
|
1237
|
+
# source://psych//psych/stream.rb#26
|
1238
|
+
def end_document(implicit_end = T.unsafe(nil)); end
|
1239
|
+
|
1240
|
+
# @return [Boolean]
|
1241
|
+
#
|
1242
|
+
# source://psych//psych/stream.rb#30
|
1243
|
+
def streaming?; end
|
1244
|
+
end
|
1245
|
+
|
1246
|
+
module Psych::Streaming
|
1247
|
+
# Start streaming using +encoding+
|
1248
|
+
#
|
1249
|
+
# source://psych//psych/streaming.rb#18
|
1250
|
+
def start(encoding = T.unsafe(nil)); end
|
1251
|
+
|
1252
|
+
private
|
1253
|
+
|
1254
|
+
# source://psych//psych/streaming.rb#25
|
1255
|
+
def register(target, obj); end
|
1256
|
+
end
|
1257
|
+
|
1258
|
+
module Psych::Streaming::ClassMethods
|
1259
|
+
# Create a new streaming emitter. Emitter will print to +io+. See
|
1260
|
+
# Psych::Stream for an example.
|
1261
|
+
#
|
1262
|
+
# source://psych//psych/streaming.rb#8
|
1263
|
+
def new(io); end
|
1264
|
+
end
|
1265
|
+
|
1266
|
+
class Psych::SyntaxError < ::Psych::Exception
|
1267
|
+
# @return [SyntaxError] a new instance of SyntaxError
|
1268
|
+
#
|
1269
|
+
# source://psych//psych/syntax_error.rb#8
|
1270
|
+
def initialize(file, line, col, offset, problem, context); end
|
1271
|
+
|
1272
|
+
# Returns the value of attribute column.
|
1273
|
+
#
|
1274
|
+
# source://psych//psych/syntax_error.rb#6
|
1275
|
+
def column; end
|
1276
|
+
|
1277
|
+
# Returns the value of attribute context.
|
1278
|
+
#
|
1279
|
+
# source://psych//psych/syntax_error.rb#6
|
1280
|
+
def context; end
|
1281
|
+
|
1282
|
+
# Returns the value of attribute file.
|
1283
|
+
#
|
1284
|
+
# source://psych//psych/syntax_error.rb#6
|
1285
|
+
def file; end
|
1286
|
+
|
1287
|
+
# Returns the value of attribute line.
|
1288
|
+
#
|
1289
|
+
# source://psych//psych/syntax_error.rb#6
|
1290
|
+
def line; end
|
1291
|
+
|
1292
|
+
# Returns the value of attribute offset.
|
1293
|
+
#
|
1294
|
+
# source://psych//psych/syntax_error.rb#6
|
1295
|
+
def offset; end
|
1296
|
+
|
1297
|
+
# Returns the value of attribute problem.
|
1298
|
+
#
|
1299
|
+
# source://psych//psych/syntax_error.rb#6
|
1300
|
+
def problem; end
|
1301
|
+
end
|
1302
|
+
|
1303
|
+
# This class works in conjunction with Psych::Parser to build an in-memory
|
1304
|
+
# parse tree that represents a YAML document.
|
1305
|
+
#
|
1306
|
+
# == Example
|
1307
|
+
#
|
1308
|
+
# parser = Psych::Parser.new Psych::TreeBuilder.new
|
1309
|
+
# parser.parse('--- foo')
|
1310
|
+
# tree = parser.handler.root
|
1311
|
+
#
|
1312
|
+
# See Psych::Handler for documentation on the event methods used in this
|
1313
|
+
# class.
|
1314
|
+
class Psych::TreeBuilder < ::Psych::Handler
|
1315
|
+
# Create a new TreeBuilder instance
|
1316
|
+
#
|
1317
|
+
# @return [TreeBuilder] a new instance of TreeBuilder
|
1318
|
+
#
|
1319
|
+
# source://psych//psych/tree_builder.rb#22
|
1320
|
+
def initialize; end
|
1321
|
+
|
1322
|
+
# source://psych//psych/tree_builder.rb#103
|
1323
|
+
def alias(anchor); end
|
1324
|
+
|
1325
|
+
# Handles end_document events with +version+, +tag_directives+,
|
1326
|
+
# and +implicit+ styling.
|
1327
|
+
#
|
1328
|
+
# See Psych::Handler#start_document
|
1329
|
+
#
|
1330
|
+
# source://psych//psych/tree_builder.rb#77
|
1331
|
+
def end_document(implicit_end = T.unsafe(nil)); end
|
1332
|
+
|
1333
|
+
# source://psych//psych/tree_builder.rb#52
|
1334
|
+
def end_mapping; end
|
1335
|
+
|
1336
|
+
# source://psych//psych/tree_builder.rb#52
|
1337
|
+
def end_sequence; end
|
1338
|
+
|
1339
|
+
# source://psych//psych/tree_builder.rb#90
|
1340
|
+
def end_stream; end
|
1341
|
+
|
1342
|
+
# source://psych//psych/tree_builder.rb#33
|
1343
|
+
def event_location(start_line, start_column, end_line, end_column); end
|
1344
|
+
|
1345
|
+
# Returns the root node for the built tree
|
1346
|
+
#
|
1347
|
+
# source://psych//psych/tree_builder.rb#19
|
1348
|
+
def root; end
|
1349
|
+
|
1350
|
+
# source://psych//psych/tree_builder.rb#96
|
1351
|
+
def scalar(value, anchor, tag, plain, quoted, style); end
|
1352
|
+
|
1353
|
+
# Handles start_document events with +version+, +tag_directives+,
|
1354
|
+
# and +implicit+ styling.
|
1355
|
+
#
|
1356
|
+
# See Psych::Handler#start_document
|
1357
|
+
#
|
1358
|
+
# source://psych//psych/tree_builder.rb#65
|
1359
|
+
def start_document(version, tag_directives, implicit); end
|
1360
|
+
|
1361
|
+
# source://psych//psych/tree_builder.rb#45
|
1362
|
+
def start_mapping(anchor, tag, implicit, style); end
|
1363
|
+
|
1364
|
+
# source://psych//psych/tree_builder.rb#45
|
1365
|
+
def start_sequence(anchor, tag, implicit, style); end
|
1366
|
+
|
1367
|
+
# source://psych//psych/tree_builder.rb#84
|
1368
|
+
def start_stream(encoding); end
|
1369
|
+
|
1370
|
+
private
|
1371
|
+
|
1372
|
+
# source://psych//psych/tree_builder.rb#116
|
1373
|
+
def pop; end
|
1374
|
+
|
1375
|
+
# source://psych//psych/tree_builder.rb#111
|
1376
|
+
def push(value); end
|
1377
|
+
|
1378
|
+
# source://psych//psych/tree_builder.rb#132
|
1379
|
+
def set_end_location(node); end
|
1380
|
+
|
1381
|
+
# source://psych//psych/tree_builder.rb#122
|
1382
|
+
def set_location(node); end
|
1383
|
+
|
1384
|
+
# source://psych//psych/tree_builder.rb#127
|
1385
|
+
def set_start_location(node); end
|
1386
|
+
end
|
1387
|
+
|
1388
|
+
# The version of Psych you are using
|
1389
|
+
#
|
1390
|
+
# source://psych//psych/versions.rb#5
|
1391
|
+
Psych::VERSION = T.let(T.unsafe(nil), String)
|
1392
|
+
|
1393
|
+
class Psych::Visitors::DepthFirst < ::Psych::Visitors::Visitor
|
1394
|
+
# @return [DepthFirst] a new instance of DepthFirst
|
1395
|
+
#
|
1396
|
+
# source://psych//psych/visitors/depth_first.rb#5
|
1397
|
+
def initialize(block); end
|
1398
|
+
|
1399
|
+
private
|
1400
|
+
|
1401
|
+
# source://psych//psych/visitors/depth_first.rb#11
|
1402
|
+
def nary(o); end
|
1403
|
+
|
1404
|
+
# source://psych//psych/visitors/depth_first.rb#20
|
1405
|
+
def terminal(o); end
|
1406
|
+
|
1407
|
+
# source://psych//psych/visitors/depth_first.rb#20
|
1408
|
+
def visit_Psych_Nodes_Alias(o); end
|
1409
|
+
|
1410
|
+
# source://psych//psych/visitors/depth_first.rb#11
|
1411
|
+
def visit_Psych_Nodes_Document(o); end
|
1412
|
+
|
1413
|
+
# source://psych//psych/visitors/depth_first.rb#11
|
1414
|
+
def visit_Psych_Nodes_Mapping(o); end
|
1415
|
+
|
1416
|
+
# source://psych//psych/visitors/depth_first.rb#20
|
1417
|
+
def visit_Psych_Nodes_Scalar(o); end
|
1418
|
+
|
1419
|
+
# source://psych//psych/visitors/depth_first.rb#11
|
1420
|
+
def visit_Psych_Nodes_Sequence(o); end
|
1421
|
+
|
1422
|
+
# source://psych//psych/visitors/depth_first.rb#11
|
1423
|
+
def visit_Psych_Nodes_Stream(o); end
|
1424
|
+
end
|
1425
|
+
|
1426
|
+
class Psych::Visitors::RestrictedYAMLTree < ::Psych::Visitors::YAMLTree
|
1427
|
+
# @return [RestrictedYAMLTree] a new instance of RestrictedYAMLTree
|
1428
|
+
#
|
1429
|
+
# source://psych//psych/visitors/yaml_tree.rb#552
|
1430
|
+
def initialize(emitter, ss, options); end
|
1431
|
+
|
1432
|
+
# source://psych//psych/visitors/yaml_tree.rb#565
|
1433
|
+
def accept(target); end
|
1434
|
+
|
1435
|
+
# source://psych//psych/visitors/yaml_tree.rb#577
|
1436
|
+
def visit_Symbol(sym); end
|
1437
|
+
end
|
1438
|
+
|
1439
|
+
# source://psych//psych/visitors/yaml_tree.rb#541
|
1440
|
+
Psych::Visitors::RestrictedYAMLTree::DEFAULT_PERMITTED_CLASSES = T.let(T.unsafe(nil), Hash)
|
1441
|
+
|
1442
|
+
# This class walks a YAML AST, converting each node to Ruby
|
1443
|
+
class Psych::Visitors::ToRuby < ::Psych::Visitors::Visitor
|
1444
|
+
# @return [ToRuby] a new instance of ToRuby
|
1445
|
+
#
|
1446
|
+
# source://psych//psych/visitors/to_ruby.rb#23
|
1447
|
+
def initialize(ss, class_loader, symbolize_names: T.unsafe(nil), freeze: T.unsafe(nil)); end
|
1448
|
+
|
1449
|
+
# source://psych//psych/visitors/to_ruby.rb#34
|
1450
|
+
def accept(target); end
|
1451
|
+
|
1452
|
+
# Returns the value of attribute class_loader.
|
1453
|
+
#
|
1454
|
+
# source://psych//psych/visitors/to_ruby.rb#21
|
1455
|
+
def class_loader; end
|
1456
|
+
|
1457
|
+
# source://psych//psych/visitors/to_ruby.rb#327
|
1458
|
+
def visit_Psych_Nodes_Alias(o); end
|
1459
|
+
|
1460
|
+
# source://psych//psych/visitors/to_ruby.rb#319
|
1461
|
+
def visit_Psych_Nodes_Document(o); end
|
1462
|
+
|
1463
|
+
# source://psych//psych/visitors/to_ruby.rb#165
|
1464
|
+
def visit_Psych_Nodes_Mapping(o); end
|
1465
|
+
|
1466
|
+
# source://psych//psych/visitors/to_ruby.rb#129
|
1467
|
+
def visit_Psych_Nodes_Scalar(o); end
|
1468
|
+
|
1469
|
+
# source://psych//psych/visitors/to_ruby.rb#133
|
1470
|
+
def visit_Psych_Nodes_Sequence(o); end
|
1471
|
+
|
1472
|
+
# source://psych//psych/visitors/to_ruby.rb#323
|
1473
|
+
def visit_Psych_Nodes_Stream(o); end
|
1474
|
+
|
1475
|
+
private
|
1476
|
+
|
1477
|
+
# source://psych//psych/visitors/to_ruby.rb#395
|
1478
|
+
def deduplicate(key); end
|
1479
|
+
|
1480
|
+
# source://psych//psych/visitors/to_ruby.rb#51
|
1481
|
+
def deserialize(o); end
|
1482
|
+
|
1483
|
+
# source://psych//psych/visitors/to_ruby.rb#412
|
1484
|
+
def init_with(o, h, node); end
|
1485
|
+
|
1486
|
+
# source://psych//psych/visitors/to_ruby.rb#404
|
1487
|
+
def merge_key(hash, key, val); end
|
1488
|
+
|
1489
|
+
# source://psych//psych/visitors/to_ruby.rb#333
|
1490
|
+
def register(node, object); end
|
1491
|
+
|
1492
|
+
# source://psych//psych/visitors/to_ruby.rb#338
|
1493
|
+
def register_empty(object); end
|
1494
|
+
|
1495
|
+
# Convert +klassname+ to a Class
|
1496
|
+
#
|
1497
|
+
# source://psych//psych/visitors/to_ruby.rb#425
|
1498
|
+
def resolve_class(klassname); end
|
1499
|
+
|
1500
|
+
# source://psych//psych/visitors/to_ruby.rb#407
|
1501
|
+
def revive(klass, node); end
|
1502
|
+
|
1503
|
+
# source://psych//psych/visitors/to_ruby.rb#344
|
1504
|
+
def revive_hash(hash, o, tagged = T.unsafe(nil)); end
|
1505
|
+
|
1506
|
+
class << self
|
1507
|
+
# source://psych//psych/visitors/to_ruby.rb#15
|
1508
|
+
def create(symbolize_names: T.unsafe(nil), freeze: T.unsafe(nil), strict_integer: T.unsafe(nil)); end
|
1509
|
+
end
|
1510
|
+
end
|
1511
|
+
|
1512
|
+
class Psych::Visitors::Visitor
|
1513
|
+
# source://psych//psych/visitors/visitor.rb#5
|
1514
|
+
def accept(target); end
|
1515
|
+
|
1516
|
+
private
|
1517
|
+
|
1518
|
+
# source://psych//psych/visitors/visitor.rb#19
|
1519
|
+
def dispatch; end
|
1520
|
+
|
1521
|
+
# source://psych//psych/visitors/visitor.rb#29
|
1522
|
+
def visit(target); end
|
1523
|
+
|
1524
|
+
class << self
|
1525
|
+
# @api private
|
1526
|
+
#
|
1527
|
+
# source://psych//psych/visitors/visitor.rb#12
|
1528
|
+
def dispatch_cache; end
|
1529
|
+
end
|
1530
|
+
end
|
1531
|
+
|
1532
|
+
# YAMLTree builds a YAML ast given a Ruby object. For example:
|
1533
|
+
#
|
1534
|
+
# builder = Psych::Visitors::YAMLTree.new
|
1535
|
+
# builder << { :foo => 'bar' }
|
1536
|
+
# builder.tree # => #<Psych::Nodes::Stream .. }
|
1537
|
+
class Psych::Visitors::YAMLTree < ::Psych::Visitors::Visitor
|
1538
|
+
# @return [YAMLTree] a new instance of YAMLTree
|
1539
|
+
#
|
1540
|
+
# source://psych//psych/visitors/yaml_tree.rb#55
|
1541
|
+
def initialize(emitter, ss, options); end
|
1542
|
+
|
1543
|
+
# source://psych//psych/visitors/yaml_tree.rb#102
|
1544
|
+
def <<(object); end
|
1545
|
+
|
1546
|
+
# source://psych//psych/visitors/yaml_tree.rb#122
|
1547
|
+
def accept(target); end
|
1548
|
+
|
1549
|
+
# source://psych//psych/visitors/yaml_tree.rb#91
|
1550
|
+
def finish; end
|
1551
|
+
|
1552
|
+
# Returns the value of attribute finished.
|
1553
|
+
#
|
1554
|
+
# source://psych//psych/visitors/yaml_tree.rb#44
|
1555
|
+
def finished; end
|
1556
|
+
|
1557
|
+
# Returns the value of attribute finished.
|
1558
|
+
#
|
1559
|
+
# source://psych//psych/visitors/yaml_tree.rb#44
|
1560
|
+
def finished?; end
|
1561
|
+
|
1562
|
+
# source://psych//psych/visitors/yaml_tree.rb#102
|
1563
|
+
def push(object); end
|
1564
|
+
|
1565
|
+
# source://psych//psych/visitors/yaml_tree.rb#85
|
1566
|
+
def start(encoding = T.unsafe(nil)); end
|
1567
|
+
|
1568
|
+
# Returns the value of attribute started.
|
1569
|
+
#
|
1570
|
+
# source://psych//psych/visitors/yaml_tree.rb#44
|
1571
|
+
def started; end
|
1572
|
+
|
1573
|
+
# Returns the value of attribute started.
|
1574
|
+
#
|
1575
|
+
# source://psych//psych/visitors/yaml_tree.rb#44
|
1576
|
+
def started?; end
|
1577
|
+
|
1578
|
+
# source://psych//psych/visitors/yaml_tree.rb#97
|
1579
|
+
def tree; end
|
1580
|
+
|
1581
|
+
# source://psych//psych/visitors/yaml_tree.rb#350
|
1582
|
+
def visit_Array(o); end
|
1583
|
+
|
1584
|
+
# source://psych//psych/visitors/yaml_tree.rb#376
|
1585
|
+
def visit_BasicObject(o); end
|
1586
|
+
|
1587
|
+
# source://psych//psych/visitors/yaml_tree.rb#250
|
1588
|
+
def visit_BigDecimal(o); end
|
1589
|
+
|
1590
|
+
# @raise [TypeError]
|
1591
|
+
#
|
1592
|
+
# source://psych//psych/visitors/yaml_tree.rb#313
|
1593
|
+
def visit_Class(o); end
|
1594
|
+
|
1595
|
+
# source://psych//psych/visitors/yaml_tree.rb#223
|
1596
|
+
def visit_Complex(o); end
|
1597
|
+
|
1598
|
+
# source://psych//psych/visitors/yaml_tree.rb#194
|
1599
|
+
def visit_Date(o); end
|
1600
|
+
|
1601
|
+
# source://psych//psych/visitors/yaml_tree.rb#198
|
1602
|
+
def visit_DateTime(o); end
|
1603
|
+
|
1604
|
+
# source://psych//psych/visitors/yaml_tree.rb#152
|
1605
|
+
def visit_Delegator(o); end
|
1606
|
+
|
1607
|
+
# source://psych//psych/visitors/yaml_tree.rb#147
|
1608
|
+
def visit_Encoding(o); end
|
1609
|
+
|
1610
|
+
# source://psych//psych/visitors/yaml_tree.rb#358
|
1611
|
+
def visit_Enumerator(o); end
|
1612
|
+
|
1613
|
+
# source://psych//psych/visitors/yaml_tree.rb#182
|
1614
|
+
def visit_Exception(o); end
|
1615
|
+
|
1616
|
+
# source://psych//psych/visitors/yaml_tree.rb#233
|
1617
|
+
def visit_FalseClass(o); end
|
1618
|
+
|
1619
|
+
# source://psych//psych/visitors/yaml_tree.rb#239
|
1620
|
+
def visit_Float(o); end
|
1621
|
+
|
1622
|
+
# source://psych//psych/visitors/yaml_tree.rb#326
|
1623
|
+
def visit_Hash(o); end
|
1624
|
+
|
1625
|
+
# source://psych//psych/visitors/yaml_tree.rb#233
|
1626
|
+
def visit_Integer(o); end
|
1627
|
+
|
1628
|
+
# @raise [TypeError]
|
1629
|
+
#
|
1630
|
+
# source://psych//psych/visitors/yaml_tree.rb#308
|
1631
|
+
def visit_Module(o); end
|
1632
|
+
|
1633
|
+
# source://psych//psych/visitors/yaml_tree.rb#186
|
1634
|
+
def visit_NameError(o); end
|
1635
|
+
|
1636
|
+
# source://psych//psych/visitors/yaml_tree.rb#364
|
1637
|
+
def visit_NilClass(o); end
|
1638
|
+
|
1639
|
+
# source://psych//psych/visitors/yaml_tree.rb#152
|
1640
|
+
def visit_Object(o); end
|
1641
|
+
|
1642
|
+
# source://psych//psych/visitors/yaml_tree.rb#139
|
1643
|
+
def visit_Psych_Omap(o); end
|
1644
|
+
|
1645
|
+
# source://psych//psych/visitors/yaml_tree.rb#339
|
1646
|
+
def visit_Psych_Set(o); end
|
1647
|
+
|
1648
|
+
# source://psych//psych/visitors/yaml_tree.rb#318
|
1649
|
+
def visit_Range(o); end
|
1650
|
+
|
1651
|
+
# source://psych//psych/visitors/yaml_tree.rb#210
|
1652
|
+
def visit_Rational(o); end
|
1653
|
+
|
1654
|
+
# source://psych//psych/visitors/yaml_tree.rb#190
|
1655
|
+
def visit_Regexp(o); end
|
1656
|
+
|
1657
|
+
# source://psych//psych/visitors/yaml_tree.rb#254
|
1658
|
+
def visit_String(o); end
|
1659
|
+
|
1660
|
+
# source://psych//psych/visitors/yaml_tree.rb#168
|
1661
|
+
def visit_Struct(o); end
|
1662
|
+
|
1663
|
+
# source://psych//psych/visitors/yaml_tree.rb#368
|
1664
|
+
def visit_Symbol(o); end
|
1665
|
+
|
1666
|
+
# source://psych//psych/visitors/yaml_tree.rb#205
|
1667
|
+
def visit_Time(o); end
|
1668
|
+
|
1669
|
+
# source://psych//psych/visitors/yaml_tree.rb#233
|
1670
|
+
def visit_TrueClass(o); end
|
1671
|
+
|
1672
|
+
private
|
1673
|
+
|
1674
|
+
# @return [Boolean]
|
1675
|
+
#
|
1676
|
+
# source://psych//psych/visitors/yaml_tree.rb#390
|
1677
|
+
def binary?(string); end
|
1678
|
+
|
1679
|
+
# source://psych//psych/visitors/yaml_tree.rb#497
|
1680
|
+
def dump_coder(o); end
|
1681
|
+
|
1682
|
+
# source://psych//psych/visitors/yaml_tree.rb#466
|
1683
|
+
def dump_exception(o, msg); end
|
1684
|
+
|
1685
|
+
# source://psych//psych/visitors/yaml_tree.rb#532
|
1686
|
+
def dump_ivars(target); end
|
1687
|
+
|
1688
|
+
# source://psych//psych/visitors/yaml_tree.rb#463
|
1689
|
+
def dump_list(o); end
|
1690
|
+
|
1691
|
+
# source://psych//psych/visitors/yaml_tree.rb#510
|
1692
|
+
def emit_coder(c, o); end
|
1693
|
+
|
1694
|
+
# source://psych//psych/visitors/yaml_tree.rb#484
|
1695
|
+
def format_time(time, utc = T.unsafe(nil)); end
|
1696
|
+
|
1697
|
+
# source://psych//psych/visitors/yaml_tree.rb#492
|
1698
|
+
def register(target, yaml_obj); end
|
1699
|
+
|
1700
|
+
# source://psych//psych/visitors/yaml_tree.rb#394
|
1701
|
+
def visit_array_subclass(o); end
|
1702
|
+
|
1703
|
+
# source://psych//psych/visitors/yaml_tree.rb#425
|
1704
|
+
def visit_hash_subclass(o); end
|
1705
|
+
|
1706
|
+
class << self
|
1707
|
+
# source://psych//psych/visitors/yaml_tree.rb#48
|
1708
|
+
def create(options = T.unsafe(nil), emitter = T.unsafe(nil)); end
|
1709
|
+
end
|
1710
|
+
end
|
1711
|
+
|
1712
|
+
class Psych::Visitors::YAMLTree::Registrar
|
1713
|
+
# @return [Registrar] a new instance of Registrar
|
1714
|
+
#
|
1715
|
+
# source://psych//psych/visitors/yaml_tree.rb#17
|
1716
|
+
def initialize; end
|
1717
|
+
|
1718
|
+
# source://psych//psych/visitors/yaml_tree.rb#35
|
1719
|
+
def id_for(target); end
|
1720
|
+
|
1721
|
+
# @return [Boolean]
|
1722
|
+
#
|
1723
|
+
# source://psych//psych/visitors/yaml_tree.rb#29
|
1724
|
+
def key?(target); end
|
1725
|
+
|
1726
|
+
# source://psych//psych/visitors/yaml_tree.rb#39
|
1727
|
+
def node_for(target); end
|
1728
|
+
|
1729
|
+
# source://psych//psych/visitors/yaml_tree.rb#24
|
1730
|
+
def register(target, node); end
|
1731
|
+
end
|