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