cybrid_api_organization_ruby 0.122.33 → 0.122.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +5 -5
  4. data/cybrid_api_organization_ruby.gemspec +1 -1
  5. data/lib/cybrid_api_organization_ruby/api/organizations_organization_api.rb +1 -1
  6. data/lib/cybrid_api_organization_ruby/api/subscription_deliveries_organization_api.rb +1 -1
  7. data/lib/cybrid_api_organization_ruby/api/subscription_events_organization_api.rb +1 -1
  8. data/lib/cybrid_api_organization_ruby/api/subscriptions_organization_api.rb +1 -1
  9. data/lib/cybrid_api_organization_ruby/api_client.rb +1 -1
  10. data/lib/cybrid_api_organization_ruby/api_error.rb +1 -1
  11. data/lib/cybrid_api_organization_ruby/configuration.rb +1 -1
  12. data/lib/cybrid_api_organization_ruby/models/error_response_organization_model.rb +1 -1
  13. data/lib/cybrid_api_organization_ruby/models/organization_organization_model.rb +1 -1
  14. data/lib/cybrid_api_organization_ruby/models/patch_organization_organization_model.rb +1 -1
  15. data/lib/cybrid_api_organization_ruby/models/post_subscription_delivery_organization_model.rb +1 -1
  16. data/lib/cybrid_api_organization_ruby/models/post_subscription_organization_model.rb +1 -1
  17. data/lib/cybrid_api_organization_ruby/models/subscription_delivery_list_organization_model.rb +1 -1
  18. data/lib/cybrid_api_organization_ruby/models/subscription_delivery_organization_model.rb +1 -1
  19. data/lib/cybrid_api_organization_ruby/models/subscription_environment_organization_model.rb +1 -1
  20. data/lib/cybrid_api_organization_ruby/models/subscription_event_list_organization_model.rb +1 -1
  21. data/lib/cybrid_api_organization_ruby/models/subscription_event_organization_model.rb +1 -1
  22. data/lib/cybrid_api_organization_ruby/models/subscription_list_organization_model.rb +1 -1
  23. data/lib/cybrid_api_organization_ruby/models/subscription_organization_model.rb +1 -1
  24. data/lib/cybrid_api_organization_ruby/models/subscription_state_organization_model.rb +1 -1
  25. data/lib/cybrid_api_organization_ruby/models/subscription_type_organization_model.rb +1 -1
  26. data/lib/cybrid_api_organization_ruby/version.rb +2 -2
  27. data/lib/cybrid_api_organization_ruby.rb +1 -1
  28. data/spec/api/organizations_organization_api_spec.rb +1 -1
  29. data/spec/api/subscription_deliveries_organization_api_spec.rb +1 -1
  30. data/spec/api/subscription_events_organization_api_spec.rb +1 -1
  31. data/spec/api/subscriptions_organization_api_spec.rb +1 -1
  32. data/spec/api_client_spec.rb +1 -1
  33. data/spec/configuration_spec.rb +1 -1
  34. data/spec/models/error_response_organization_model_spec.rb +1 -1
  35. data/spec/models/organization_organization_model_spec.rb +1 -1
  36. data/spec/models/patch_organization_organization_model_spec.rb +1 -1
  37. data/spec/models/post_subscription_delivery_organization_model_spec.rb +1 -1
  38. data/spec/models/post_subscription_organization_model_spec.rb +1 -1
  39. data/spec/models/subscription_delivery_list_organization_model_spec.rb +1 -1
  40. data/spec/models/subscription_delivery_organization_model_spec.rb +1 -1
  41. data/spec/models/subscription_environment_organization_model_spec.rb +1 -1
  42. data/spec/models/subscription_event_list_organization_model_spec.rb +1 -1
  43. data/spec/models/subscription_event_organization_model_spec.rb +1 -1
  44. data/spec/models/subscription_list_organization_model_spec.rb +1 -1
  45. data/spec/models/subscription_organization_model_spec.rb +1 -1
  46. data/spec/models/subscription_state_organization_model_spec.rb +1 -1
  47. data/spec/models/subscription_type_organization_model_spec.rb +1 -1
  48. data/spec/spec_helper.rb +1 -1
  49. data/vendor/bundle/ruby/3.3.0/cache/psych-5.2.0.gem +0 -0
  50. data/vendor/bundle/ruby/3.3.0/cache/stringio-3.1.2.gem +0 -0
  51. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/byebug-11.1.3/gem_make.out +5 -5
  52. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  53. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{psych-5.1.2 → psych-5.2.0}/gem_make.out +18 -18
  54. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{psych-5.1.2 → psych-5.2.0}/psych.so +0 -0
  55. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/gem_make.out +5 -5
  56. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{stringio-3.1.1 → stringio-3.1.2}/gem_make.out +18 -18
  57. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/stringio-3.1.2/stringio.so +0 -0
  58. data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/psych.c +1 -1
  59. data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/psych_emitter.c +154 -120
  60. data/vendor/bundle/ruby/3.3.0/gems/psych-5.2.0/ext/psych/psych_parser.c +565 -0
  61. data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/nodes/node.rb +1 -1
  62. data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/scalar_scanner.rb +10 -9
  63. data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/versions.rb +1 -1
  64. data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/visitors/to_ruby.rb +1 -1
  65. data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/visitors/yaml_tree.rb +7 -10
  66. data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych.rb +19 -3
  67. data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych.so +0 -0
  68. data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/NEWS.md +19 -0
  69. data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/ext/stringio/stringio.c +23 -13
  70. data/vendor/bundle/ruby/3.3.0/gems/stringio-3.1.2/lib/stringio.so +0 -0
  71. data/vendor/bundle/ruby/3.3.0/specifications/{psych-5.1.2.gemspec → psych-5.2.0.gemspec} +5 -5
  72. data/vendor/bundle/ruby/3.3.0/specifications/{stringio-3.1.1.gemspec → stringio-3.1.2.gemspec} +4 -4
  73. metadata +79 -79
  74. data/vendor/bundle/ruby/3.3.0/cache/psych-5.1.2.gem +0 -0
  75. data/vendor/bundle/ruby/3.3.0/cache/stringio-3.1.1.gem +0 -0
  76. data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/stringio-3.1.1/stringio.so +0 -0
  77. data/vendor/bundle/ruby/3.3.0/gems/psych-5.1.2/ext/psych/psych_parser.c +0 -565
  78. data/vendor/bundle/ruby/3.3.0/gems/stringio-3.1.1/lib/stringio.so +0 -0
  79. /data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{psych-5.1.2 → psych-5.2.0}/gem.build_complete +0 -0
  80. /data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{psych-5.1.2 → psych-5.2.0}/mkmf.log +0 -0
  81. /data/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/{stringio-3.1.1 → stringio-3.1.2}/gem.build_complete +0 -0
  82. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/CONTRIBUTING.md +0 -0
  83. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/LICENSE +0 -0
  84. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/README.md +0 -0
  85. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/Makefile +0 -0
  86. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/depend +0 -0
  87. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/extconf.rb +0 -0
  88. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/psych.h +0 -0
  89. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/psych_emitter.h +0 -0
  90. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/psych_parser.h +0 -0
  91. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/psych_to_ruby.c +0 -0
  92. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/psych_to_ruby.h +0 -0
  93. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/psych_yaml_tree.c +0 -0
  94. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/ext/psych/psych_yaml_tree.h +0 -0
  95. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/class_loader.rb +0 -0
  96. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/coder.rb +0 -0
  97. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/core_ext.rb +0 -0
  98. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/exception.rb +0 -0
  99. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/handler.rb +0 -0
  100. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/handlers/document_stream.rb +0 -0
  101. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/handlers/recorder.rb +0 -0
  102. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/json/ruby_events.rb +0 -0
  103. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/json/stream.rb +0 -0
  104. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/json/tree_builder.rb +0 -0
  105. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/json/yaml_events.rb +0 -0
  106. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/nodes/alias.rb +0 -0
  107. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/nodes/document.rb +0 -0
  108. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/nodes/mapping.rb +0 -0
  109. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/nodes/scalar.rb +0 -0
  110. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/nodes/sequence.rb +0 -0
  111. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/nodes/stream.rb +0 -0
  112. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/nodes.rb +0 -0
  113. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/omap.rb +0 -0
  114. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/parser.rb +0 -0
  115. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/set.rb +0 -0
  116. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/stream.rb +0 -0
  117. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/streaming.rb +0 -0
  118. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/syntax_error.rb +0 -0
  119. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/tree_builder.rb +0 -0
  120. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/visitors/depth_first.rb +0 -0
  121. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/visitors/emitter.rb +0 -0
  122. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/visitors/json_tree.rb +0 -0
  123. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/visitors/visitor.rb +0 -0
  124. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/visitors.rb +0 -0
  125. /data/vendor/bundle/ruby/3.3.0/gems/{psych-5.1.2 → psych-5.2.0}/lib/psych/y.rb +0 -0
  126. /data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/.document +0 -0
  127. /data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/.rdoc_options +0 -0
  128. /data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/COPYING +0 -0
  129. /data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/LICENSE.txt +0 -0
  130. /data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/README.md +0 -0
  131. /data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/docs/io.rb +0 -0
  132. /data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/ext/stringio/.document +0 -0
  133. /data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/ext/stringio/Makefile +0 -0
  134. /data/vendor/bundle/ruby/3.3.0/gems/{stringio-3.1.1 → stringio-3.1.2}/ext/stringio/extconf.rb +0 -0
@@ -17,7 +17,7 @@ static ID id_canonical;
17
17
  static void emit(yaml_emitter_t * emitter, yaml_event_t * event)
18
18
  {
19
19
  if(!yaml_emitter_emit(emitter, event))
20
- rb_raise(rb_eRuntimeError, "%s", emitter->problem);
20
+ rb_raise(rb_eRuntimeError, "%s", emitter->problem);
21
21
  }
22
22
 
23
23
  static int writer(void *ctx, unsigned char *buffer, size_t size)
@@ -82,13 +82,13 @@ static VALUE initialize(int argc, VALUE *argv, VALUE self)
82
82
  TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
83
83
 
84
84
  if (rb_scan_args(argc, argv, "11", &io, &options) == 2) {
85
- line_width = rb_funcall(options, id_line_width, 0);
86
- indent = rb_funcall(options, id_indentation, 0);
87
- canonical = rb_funcall(options, id_canonical, 0);
85
+ line_width = rb_funcall(options, id_line_width, 0);
86
+ indent = rb_funcall(options, id_indentation, 0);
87
+ canonical = rb_funcall(options, id_canonical, 0);
88
88
 
89
- yaml_emitter_set_width(emitter, NUM2INT(line_width));
90
- yaml_emitter_set_indent(emitter, NUM2INT(indent));
91
- yaml_emitter_set_canonical(emitter, Qtrue == canonical ? 1 : 0);
89
+ yaml_emitter_set_width(emitter, NUM2INT(line_width));
90
+ yaml_emitter_set_indent(emitter, NUM2INT(indent));
91
+ yaml_emitter_set_canonical(emitter, Qtrue == canonical ? 1 : 0);
92
92
  }
93
93
 
94
94
  rb_ivar_set(self, id_io, io);
@@ -136,84 +136,118 @@ static VALUE end_stream(VALUE self)
136
136
  return self;
137
137
  }
138
138
 
139
- /* call-seq: emitter.start_document(version, tags, implicit)
140
- *
141
- * Start a document emission with YAML +version+, +tags+, and an +implicit+
142
- * start.
143
- *
144
- * See Psych::Handler#start_document
145
- */
146
- static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
139
+ struct start_document_data {
140
+ VALUE self;
141
+ VALUE version;
142
+ VALUE tags;
143
+ VALUE imp;
144
+
145
+ yaml_tag_directive_t * head;
146
+ };
147
+
148
+ static VALUE start_document_try(VALUE d)
147
149
  {
150
+ struct start_document_data * data = (struct start_document_data *)d;
151
+ VALUE self = data->self;
152
+ VALUE version = data->version;
153
+ VALUE tags = data->tags;
154
+ VALUE imp = data->imp;
155
+
148
156
  yaml_emitter_t * emitter;
149
- yaml_tag_directive_t * head = NULL;
150
157
  yaml_tag_directive_t * tail = NULL;
151
158
  yaml_event_t event;
152
159
  yaml_version_directive_t version_directive;
153
160
  TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
154
161
 
155
-
156
162
  Check_Type(version, T_ARRAY);
157
163
 
158
164
  if(RARRAY_LEN(version) > 0) {
159
- VALUE major = rb_ary_entry(version, (long)0);
160
- VALUE minor = rb_ary_entry(version, (long)1);
165
+ VALUE major = rb_ary_entry(version, (long)0);
166
+ VALUE minor = rb_ary_entry(version, (long)1);
161
167
 
162
- version_directive.major = NUM2INT(major);
163
- version_directive.minor = NUM2INT(minor);
168
+ version_directive.major = NUM2INT(major);
169
+ version_directive.minor = NUM2INT(minor);
164
170
  }
165
171
 
166
172
  if(RTEST(tags)) {
167
- long i = 0;
168
- long len;
169
- rb_encoding * encoding = rb_utf8_encoding();
170
-
171
- Check_Type(tags, T_ARRAY);
172
-
173
- len = RARRAY_LEN(tags);
174
- head = xcalloc((size_t)len, sizeof(yaml_tag_directive_t));
175
- tail = head;
176
-
177
- for(i = 0; i < len && i < RARRAY_LEN(tags); i++) {
178
- VALUE tuple = RARRAY_AREF(tags, i);
179
- VALUE name;
180
- VALUE value;
181
-
182
- Check_Type(tuple, T_ARRAY);
183
-
184
- if(RARRAY_LEN(tuple) < 2) {
185
- xfree(head);
186
- rb_raise(rb_eRuntimeError, "tag tuple must be of length 2");
187
- }
188
- name = RARRAY_AREF(tuple, 0);
189
- value = RARRAY_AREF(tuple, 1);
190
- StringValue(name);
191
- StringValue(value);
192
- name = rb_str_export_to_enc(name, encoding);
193
- value = rb_str_export_to_enc(value, encoding);
194
-
195
- tail->handle = (yaml_char_t *)StringValueCStr(name);
196
- tail->prefix = (yaml_char_t *)StringValueCStr(value);
197
-
198
- tail++;
199
- }
173
+ long i = 0;
174
+ long len;
175
+ rb_encoding * encoding = rb_utf8_encoding();
176
+
177
+ Check_Type(tags, T_ARRAY);
178
+
179
+ len = RARRAY_LEN(tags);
180
+ data->head = xcalloc((size_t)len, sizeof(yaml_tag_directive_t));
181
+ tail = data->head;
182
+
183
+ for(i = 0; i < len && i < RARRAY_LEN(tags); i++) {
184
+ VALUE tuple = RARRAY_AREF(tags, i);
185
+ VALUE name;
186
+ VALUE value;
187
+
188
+ Check_Type(tuple, T_ARRAY);
189
+
190
+ if(RARRAY_LEN(tuple) < 2) {
191
+ rb_raise(rb_eRuntimeError, "tag tuple must be of length 2");
192
+ }
193
+
194
+ name = RARRAY_AREF(tuple, 0);
195
+ value = RARRAY_AREF(tuple, 1);
196
+ StringValue(name);
197
+ StringValue(value);
198
+ name = rb_str_export_to_enc(name, encoding);
199
+ value = rb_str_export_to_enc(value, encoding);
200
+
201
+ tail->handle = (yaml_char_t *)StringValueCStr(name);
202
+ tail->prefix = (yaml_char_t *)StringValueCStr(value);
203
+
204
+ tail++;
205
+ }
200
206
  }
201
207
 
202
208
  yaml_document_start_event_initialize(
203
- &event,
204
- (RARRAY_LEN(version) > 0) ? &version_directive : NULL,
205
- head,
206
- tail,
207
- imp ? 1 : 0
208
- );
209
+ &event,
210
+ (RARRAY_LEN(version) > 0) ? &version_directive : NULL,
211
+ data->head,
212
+ tail,
213
+ imp ? 1 : 0
214
+ );
209
215
 
210
216
  emit(emitter, &event);
211
217
 
212
- if(head) xfree(head);
213
-
214
218
  return self;
215
219
  }
216
220
 
221
+ static VALUE start_document_ensure(VALUE d)
222
+ {
223
+ struct start_document_data * data = (struct start_document_data *)d;
224
+
225
+ xfree(data->head);
226
+
227
+ return Qnil;
228
+ }
229
+
230
+ /* call-seq: emitter.start_document(version, tags, implicit)
231
+ *
232
+ * Start a document emission with YAML +version+, +tags+, and an +implicit+
233
+ * start.
234
+ *
235
+ * See Psych::Handler#start_document
236
+ */
237
+ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
238
+ {
239
+ struct start_document_data data = {
240
+ .self = self,
241
+ .version = version,
242
+ .tags = tags,
243
+ .imp = imp,
244
+
245
+ .head = NULL,
246
+ };
247
+
248
+ return rb_ensure(start_document_try, (VALUE)&data, start_document_ensure, (VALUE)&data);
249
+ }
250
+
217
251
  /* call-seq: emitter.end_document(implicit)
218
252
  *
219
253
  * End a document emission with an +implicit+ ending.
@@ -241,14 +275,14 @@ static VALUE end_document(VALUE self, VALUE imp)
241
275
  * See Psych::Handler#scalar
242
276
  */
243
277
  static VALUE scalar(
244
- VALUE self,
245
- VALUE value,
246
- VALUE anchor,
247
- VALUE tag,
248
- VALUE plain,
249
- VALUE quoted,
250
- VALUE style
251
- ) {
278
+ VALUE self,
279
+ VALUE value,
280
+ VALUE anchor,
281
+ VALUE tag,
282
+ VALUE plain,
283
+ VALUE quoted,
284
+ VALUE style
285
+ ) {
252
286
  yaml_emitter_t * emitter;
253
287
  yaml_event_t event;
254
288
  rb_encoding *encoding;
@@ -261,25 +295,25 @@ static VALUE scalar(
261
295
  value = rb_str_export_to_enc(value, encoding);
262
296
 
263
297
  if(!NIL_P(anchor)) {
264
- Check_Type(anchor, T_STRING);
265
- anchor = rb_str_export_to_enc(anchor, encoding);
298
+ Check_Type(anchor, T_STRING);
299
+ anchor = rb_str_export_to_enc(anchor, encoding);
266
300
  }
267
301
 
268
302
  if(!NIL_P(tag)) {
269
- Check_Type(tag, T_STRING);
270
- tag = rb_str_export_to_enc(tag, encoding);
303
+ Check_Type(tag, T_STRING);
304
+ tag = rb_str_export_to_enc(tag, encoding);
271
305
  }
272
306
 
273
307
  yaml_scalar_event_initialize(
274
- &event,
275
- (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
276
- (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
277
- (yaml_char_t*)StringValuePtr(value),
278
- (int)RSTRING_LEN(value),
279
- plain ? 1 : 0,
280
- quoted ? 1 : 0,
281
- (yaml_scalar_style_t)NUM2INT(style)
282
- );
308
+ &event,
309
+ (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
310
+ (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
311
+ (yaml_char_t*)StringValuePtr(value),
312
+ (int)RSTRING_LEN(value),
313
+ plain ? 1 : 0,
314
+ quoted ? 1 : 0,
315
+ (yaml_scalar_style_t)NUM2INT(style)
316
+ );
283
317
 
284
318
  emit(emitter, &event);
285
319
 
@@ -294,36 +328,36 @@ static VALUE scalar(
294
328
  * See Psych::Handler#start_sequence
295
329
  */
296
330
  static VALUE start_sequence(
297
- VALUE self,
298
- VALUE anchor,
299
- VALUE tag,
300
- VALUE implicit,
301
- VALUE style
302
- ) {
331
+ VALUE self,
332
+ VALUE anchor,
333
+ VALUE tag,
334
+ VALUE implicit,
335
+ VALUE style
336
+ ) {
303
337
  yaml_emitter_t * emitter;
304
338
  yaml_event_t event;
305
339
 
306
340
  rb_encoding * encoding = rb_utf8_encoding();
307
341
 
308
342
  if(!NIL_P(anchor)) {
309
- Check_Type(anchor, T_STRING);
310
- anchor = rb_str_export_to_enc(anchor, encoding);
343
+ Check_Type(anchor, T_STRING);
344
+ anchor = rb_str_export_to_enc(anchor, encoding);
311
345
  }
312
346
 
313
347
  if(!NIL_P(tag)) {
314
- Check_Type(tag, T_STRING);
315
- tag = rb_str_export_to_enc(tag, encoding);
348
+ Check_Type(tag, T_STRING);
349
+ tag = rb_str_export_to_enc(tag, encoding);
316
350
  }
317
351
 
318
352
  TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
319
353
 
320
354
  yaml_sequence_start_event_initialize(
321
- &event,
322
- (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
323
- (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
324
- implicit ? 1 : 0,
325
- (yaml_sequence_style_t)NUM2INT(style)
326
- );
355
+ &event,
356
+ (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
357
+ (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
358
+ implicit ? 1 : 0,
359
+ (yaml_sequence_style_t)NUM2INT(style)
360
+ );
327
361
 
328
362
  emit(emitter, &event);
329
363
 
@@ -357,12 +391,12 @@ static VALUE end_sequence(VALUE self)
357
391
  * See Psych::Handler#start_mapping
358
392
  */
359
393
  static VALUE start_mapping(
360
- VALUE self,
361
- VALUE anchor,
362
- VALUE tag,
363
- VALUE implicit,
364
- VALUE style
365
- ) {
394
+ VALUE self,
395
+ VALUE anchor,
396
+ VALUE tag,
397
+ VALUE implicit,
398
+ VALUE style
399
+ ) {
366
400
  yaml_emitter_t * emitter;
367
401
  yaml_event_t event;
368
402
  rb_encoding *encoding;
@@ -372,22 +406,22 @@ static VALUE start_mapping(
372
406
  encoding = rb_utf8_encoding();
373
407
 
374
408
  if(!NIL_P(anchor)) {
375
- Check_Type(anchor, T_STRING);
376
- anchor = rb_str_export_to_enc(anchor, encoding);
409
+ Check_Type(anchor, T_STRING);
410
+ anchor = rb_str_export_to_enc(anchor, encoding);
377
411
  }
378
412
 
379
413
  if(!NIL_P(tag)) {
380
- Check_Type(tag, T_STRING);
381
- tag = rb_str_export_to_enc(tag, encoding);
414
+ Check_Type(tag, T_STRING);
415
+ tag = rb_str_export_to_enc(tag, encoding);
382
416
  }
383
417
 
384
418
  yaml_mapping_start_event_initialize(
385
- &event,
386
- (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
387
- (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
388
- implicit ? 1 : 0,
389
- (yaml_mapping_style_t)NUM2INT(style)
390
- );
419
+ &event,
420
+ (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
421
+ (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
422
+ implicit ? 1 : 0,
423
+ (yaml_mapping_style_t)NUM2INT(style)
424
+ );
391
425
 
392
426
  emit(emitter, &event);
393
427
 
@@ -426,14 +460,14 @@ static VALUE alias(VALUE self, VALUE anchor)
426
460
  TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
427
461
 
428
462
  if(!NIL_P(anchor)) {
429
- Check_Type(anchor, T_STRING);
430
- anchor = rb_str_export_to_enc(anchor, rb_utf8_encoding());
463
+ Check_Type(anchor, T_STRING);
464
+ anchor = rb_str_export_to_enc(anchor, rb_utf8_encoding());
431
465
  }
432
466
 
433
467
  yaml_alias_event_initialize(
434
- &event,
435
- (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor))
436
- );
468
+ &event,
469
+ (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor))
470
+ );
437
471
 
438
472
  emit(emitter, &event);
439
473