cybrid_api_id_ruby 0.9.0 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +5 -5
- data/cybrid_api_id_ruby.gemspec +1 -1
- data/lib/cybrid_api_id_ruby/api/bank_applications_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/organization_applications_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api_client.rb +1 -1
- data/lib/cybrid_api_id_ruby/api_error.rb +1 -1
- data/lib/cybrid_api_id_ruby/configuration.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_list_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_with_secret_all_of_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_with_secret_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_bank_application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_organization_application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/version.rb +2 -2
- data/lib/cybrid_api_id_ruby.rb +1 -1
- data/spec/api/bank_applications_idp_api_spec.rb +1 -1
- data/spec/api/organization_applications_idp_api_spec.rb +1 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/application_idp_model_spec.rb +1 -1
- data/spec/models/application_list_idp_model_spec.rb +1 -1
- data/spec/models/application_with_secret_all_of_idp_model_spec.rb +1 -1
- data/spec/models/application_with_secret_idp_model_spec.rb +1 -1
- data/spec/models/post_bank_application_idp_model_spec.rb +1 -1
- data/spec/models/post_organization_application_idp_model_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/vendor/bundle/ruby/3.1.0/cache/psych-4.0.4.gem +0 -0
- data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/byebug-11.1.3/gem_make.out +2 -2
- data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/ffi-1.15.5/gem_make.out +2 -2
- data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/jaro_winkler-1.5.4/gem_make.out +2 -2
- data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/gem.build_complete +0 -0
- data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/gem_make.out +27 -0
- data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/mkmf.log +75 -0
- data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/psych.so +0 -0
- data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/stringio-3.0.2/gem_make.out +2 -2
- data/vendor/bundle/ruby/3.1.0/gems/byebug-11.1.3/ext/byebug/Makefile +2 -2
- data/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/ext/ffi_c/Makefile +2 -2
- data/vendor/bundle/ruby/3.1.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler/Makefile +2 -2
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/.gitignore +16 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/Gemfile +9 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/LICENSE +21 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/Mavenfile +7 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/README.md +72 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/Rakefile +41 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/bin/console +7 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/bin/setup +6 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/.sitearchdir.time +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/Makefile +274 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/depend +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/extconf.rb +43 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.c +37 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.h +17 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.o +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.so +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_emitter.c +555 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_emitter.h +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_emitter.o +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_parser.c +579 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_parser.h +6 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_parser.o +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_to_ruby.c +39 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_to_ruby.h +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_to_ruby.o +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_yaml_tree.c +12 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_yaml_tree.h +8 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_yaml_tree.o +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/LICENSE +19 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/api.c +1393 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/config.h +80 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/dumper.c +394 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/emitter.c +2358 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/loader.c +544 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/parser.c +1375 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/reader.c +469 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/scanner.c +3598 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/writer.c +141 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/yaml.h +1985 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/yaml_private.h +688 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/class_loader.rb +104 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/coder.rb +95 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/core_ext.rb +19 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/exception.rb +14 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/handler.rb +255 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/handlers/document_stream.rb +23 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/handlers/recorder.rb +40 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/ruby_events.rb +20 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/stream.rb +17 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/tree_builder.rb +13 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/yaml_events.rb +30 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/alias.rb +21 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/document.rb +63 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/mapping.rb +59 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/node.rb +75 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/scalar.rb +70 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/sequence.rb +84 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/stream.rb +40 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes.rb +78 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/omap.rb +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/parser.rb +52 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/scalar_scanner.rb +142 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/set.rb +5 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/stream.rb +38 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/streaming.rb +28 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/syntax_error.rb +22 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/tree_builder.rb +137 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/versions.rb +10 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/depth_first.rb +27 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/emitter.rb +52 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/json_tree.rb +25 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/to_ruby.rb +434 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/visitor.rb +34 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/yaml_tree.rb +587 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors.rb +7 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/y.rb +10 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych.rb +741 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych.so +0 -0
- data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/psych.gemspec +69 -0
- data/vendor/bundle/ruby/3.1.0/gems/stringio-3.0.2/ext/stringio/Makefile +2 -2
- data/vendor/bundle/ruby/3.1.0/specifications/psych-4.0.4.gemspec +36 -0
- metadata +86 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Psych
|
|
3
|
+
###
|
|
4
|
+
# Psych::Stream is a streaming YAML emitter. It will not buffer your YAML,
|
|
5
|
+
# but send it straight to an IO.
|
|
6
|
+
#
|
|
7
|
+
# Here is an example use:
|
|
8
|
+
#
|
|
9
|
+
# stream = Psych::Stream.new($stdout)
|
|
10
|
+
# stream.start
|
|
11
|
+
# stream.push({:foo => 'bar'})
|
|
12
|
+
# stream.finish
|
|
13
|
+
#
|
|
14
|
+
# YAML will be immediately emitted to $stdout with no buffering.
|
|
15
|
+
#
|
|
16
|
+
# Psych::Stream#start will take a block and ensure that Psych::Stream#finish
|
|
17
|
+
# is called, so you can do this form:
|
|
18
|
+
#
|
|
19
|
+
# stream = Psych::Stream.new($stdout)
|
|
20
|
+
# stream.start do |em|
|
|
21
|
+
# em.push(:foo => 'bar')
|
|
22
|
+
# end
|
|
23
|
+
#
|
|
24
|
+
class Stream < Psych::Visitors::YAMLTree
|
|
25
|
+
class Emitter < Psych::Emitter # :nodoc:
|
|
26
|
+
def end_document implicit_end = !streaming?
|
|
27
|
+
super
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def streaming?
|
|
31
|
+
true
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
include Psych::Streaming
|
|
36
|
+
extend Psych::Streaming::ClassMethods
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Psych
|
|
3
|
+
module Streaming
|
|
4
|
+
module ClassMethods
|
|
5
|
+
###
|
|
6
|
+
# Create a new streaming emitter. Emitter will print to +io+. See
|
|
7
|
+
# Psych::Stream for an example.
|
|
8
|
+
def new io
|
|
9
|
+
emitter = const_get(:Emitter).new(io)
|
|
10
|
+
class_loader = ClassLoader.new
|
|
11
|
+
ss = ScalarScanner.new class_loader
|
|
12
|
+
super(emitter, ss, {})
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
###
|
|
17
|
+
# Start streaming using +encoding+
|
|
18
|
+
def start encoding = Nodes::Stream::UTF8
|
|
19
|
+
super.tap { yield self if block_given? }
|
|
20
|
+
ensure
|
|
21
|
+
finish if block_given?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
def register target, obj
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require_relative 'exception'
|
|
3
|
+
|
|
4
|
+
module Psych
|
|
5
|
+
class SyntaxError < Psych::Exception
|
|
6
|
+
attr_reader :file, :line, :column, :offset, :problem, :context
|
|
7
|
+
|
|
8
|
+
def initialize file, line, col, offset, problem, context
|
|
9
|
+
err = [problem, context].compact.join ' '
|
|
10
|
+
filename = file || '<unknown>'
|
|
11
|
+
message = "(%s): %s at line %d column %d" % [filename, err, line, col]
|
|
12
|
+
|
|
13
|
+
@file = file
|
|
14
|
+
@line = line
|
|
15
|
+
@column = col
|
|
16
|
+
@offset = offset
|
|
17
|
+
@problem = problem
|
|
18
|
+
@context = context
|
|
19
|
+
super(message)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require_relative 'handler'
|
|
3
|
+
|
|
4
|
+
module Psych
|
|
5
|
+
###
|
|
6
|
+
# This class works in conjunction with Psych::Parser to build an in-memory
|
|
7
|
+
# parse tree that represents a YAML document.
|
|
8
|
+
#
|
|
9
|
+
# == Example
|
|
10
|
+
#
|
|
11
|
+
# parser = Psych::Parser.new Psych::TreeBuilder.new
|
|
12
|
+
# parser.parse('--- foo')
|
|
13
|
+
# tree = parser.handler.root
|
|
14
|
+
#
|
|
15
|
+
# See Psych::Handler for documentation on the event methods used in this
|
|
16
|
+
# class.
|
|
17
|
+
class TreeBuilder < Psych::Handler
|
|
18
|
+
# Returns the root node for the built tree
|
|
19
|
+
attr_reader :root
|
|
20
|
+
|
|
21
|
+
# Create a new TreeBuilder instance
|
|
22
|
+
def initialize
|
|
23
|
+
@stack = []
|
|
24
|
+
@last = nil
|
|
25
|
+
@root = nil
|
|
26
|
+
|
|
27
|
+
@start_line = nil
|
|
28
|
+
@start_column = nil
|
|
29
|
+
@end_line = nil
|
|
30
|
+
@end_column = nil
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def event_location(start_line, start_column, end_line, end_column)
|
|
34
|
+
@start_line = start_line
|
|
35
|
+
@start_column = start_column
|
|
36
|
+
@end_line = end_line
|
|
37
|
+
@end_column = end_column
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
%w{
|
|
41
|
+
Sequence
|
|
42
|
+
Mapping
|
|
43
|
+
}.each do |node|
|
|
44
|
+
class_eval %{
|
|
45
|
+
def start_#{node.downcase}(anchor, tag, implicit, style)
|
|
46
|
+
n = Nodes::#{node}.new(anchor, tag, implicit, style)
|
|
47
|
+
set_start_location(n)
|
|
48
|
+
@last.children << n
|
|
49
|
+
push n
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def end_#{node.downcase}
|
|
53
|
+
n = pop
|
|
54
|
+
set_end_location(n)
|
|
55
|
+
n
|
|
56
|
+
end
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
###
|
|
61
|
+
# Handles start_document events with +version+, +tag_directives+,
|
|
62
|
+
# and +implicit+ styling.
|
|
63
|
+
#
|
|
64
|
+
# See Psych::Handler#start_document
|
|
65
|
+
def start_document version, tag_directives, implicit
|
|
66
|
+
n = Nodes::Document.new version, tag_directives, implicit
|
|
67
|
+
set_start_location(n)
|
|
68
|
+
@last.children << n
|
|
69
|
+
push n
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
###
|
|
73
|
+
# Handles end_document events with +version+, +tag_directives+,
|
|
74
|
+
# and +implicit+ styling.
|
|
75
|
+
#
|
|
76
|
+
# See Psych::Handler#start_document
|
|
77
|
+
def end_document implicit_end = !streaming?
|
|
78
|
+
@last.implicit_end = implicit_end
|
|
79
|
+
n = pop
|
|
80
|
+
set_end_location(n)
|
|
81
|
+
n
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def start_stream encoding
|
|
85
|
+
@root = Nodes::Stream.new(encoding)
|
|
86
|
+
set_start_location(@root)
|
|
87
|
+
push @root
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def end_stream
|
|
91
|
+
n = pop
|
|
92
|
+
set_end_location(n)
|
|
93
|
+
n
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def scalar value, anchor, tag, plain, quoted, style
|
|
97
|
+
s = Nodes::Scalar.new(value,anchor,tag,plain,quoted,style)
|
|
98
|
+
set_location(s)
|
|
99
|
+
@last.children << s
|
|
100
|
+
s
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def alias anchor
|
|
104
|
+
a = Nodes::Alias.new(anchor)
|
|
105
|
+
set_location(a)
|
|
106
|
+
@last.children << a
|
|
107
|
+
a
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
private
|
|
111
|
+
def push value
|
|
112
|
+
@stack.push value
|
|
113
|
+
@last = value
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def pop
|
|
117
|
+
x = @stack.pop
|
|
118
|
+
@last = @stack.last
|
|
119
|
+
x
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def set_location(node)
|
|
123
|
+
set_start_location(node)
|
|
124
|
+
set_end_location(node)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def set_start_location(node)
|
|
128
|
+
node.start_line = @start_line
|
|
129
|
+
node.start_column = @start_column
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def set_end_location(node)
|
|
133
|
+
node.end_line = @end_line
|
|
134
|
+
node.end_column = @end_column
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Psych
|
|
3
|
+
module Visitors
|
|
4
|
+
class DepthFirst < Psych::Visitors::Visitor
|
|
5
|
+
def initialize block
|
|
6
|
+
@block = block
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def nary o
|
|
12
|
+
o.children.each { |x| visit x }
|
|
13
|
+
@block.call o
|
|
14
|
+
end
|
|
15
|
+
alias :visit_Psych_Nodes_Stream :nary
|
|
16
|
+
alias :visit_Psych_Nodes_Document :nary
|
|
17
|
+
alias :visit_Psych_Nodes_Sequence :nary
|
|
18
|
+
alias :visit_Psych_Nodes_Mapping :nary
|
|
19
|
+
|
|
20
|
+
def terminal o
|
|
21
|
+
@block.call o
|
|
22
|
+
end
|
|
23
|
+
alias :visit_Psych_Nodes_Scalar :terminal
|
|
24
|
+
alias :visit_Psych_Nodes_Alias :terminal
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Psych
|
|
3
|
+
module Visitors
|
|
4
|
+
class Emitter < Psych::Visitors::Visitor
|
|
5
|
+
def initialize io, options = {}
|
|
6
|
+
opts = [:indentation, :canonical, :line_width].find_all { |opt|
|
|
7
|
+
options.key?(opt)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if opts.empty?
|
|
11
|
+
@handler = Psych::Emitter.new io
|
|
12
|
+
else
|
|
13
|
+
du = Handler::DumperOptions.new
|
|
14
|
+
opts.each { |option| du.send :"#{option}=", options[option] }
|
|
15
|
+
@handler = Psych::Emitter.new io, du
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def visit_Psych_Nodes_Stream o
|
|
20
|
+
@handler.start_stream o.encoding
|
|
21
|
+
o.children.each { |c| accept c }
|
|
22
|
+
@handler.end_stream
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def visit_Psych_Nodes_Document o
|
|
26
|
+
@handler.start_document o.version, o.tag_directives, o.implicit
|
|
27
|
+
o.children.each { |c| accept c }
|
|
28
|
+
@handler.end_document o.implicit_end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def visit_Psych_Nodes_Scalar o
|
|
32
|
+
@handler.scalar o.value, o.anchor, o.tag, o.plain, o.quoted, o.style
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def visit_Psych_Nodes_Sequence o
|
|
36
|
+
@handler.start_sequence o.anchor, o.tag, o.implicit, o.style
|
|
37
|
+
o.children.each { |c| accept c }
|
|
38
|
+
@handler.end_sequence
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def visit_Psych_Nodes_Mapping o
|
|
42
|
+
@handler.start_mapping o.anchor, o.tag, o.implicit, o.style
|
|
43
|
+
o.children.each { |c| accept c }
|
|
44
|
+
@handler.end_mapping
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def visit_Psych_Nodes_Alias o
|
|
48
|
+
@handler.alias o.anchor
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require_relative '../json/ruby_events'
|
|
3
|
+
|
|
4
|
+
module Psych
|
|
5
|
+
module Visitors
|
|
6
|
+
class JSONTree < YAMLTree
|
|
7
|
+
include Psych::JSON::RubyEvents
|
|
8
|
+
|
|
9
|
+
def self.create options = {}
|
|
10
|
+
emitter = Psych::JSON::TreeBuilder.new
|
|
11
|
+
class_loader = ClassLoader.new
|
|
12
|
+
ss = ScalarScanner.new class_loader
|
|
13
|
+
new(emitter, ss, options)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def accept target
|
|
17
|
+
if target.respond_to?(:encode_with)
|
|
18
|
+
dump_coder target
|
|
19
|
+
else
|
|
20
|
+
send(@dispatch_cache[target.class], target)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|