Method: Psych::Emitter#start_sequence
- Defined in:
- ext/psych/psych_emitter.c
#start_sequence(anchor, tag, implicit, style) ⇒ Object
Start emitting a sequence with anchor, a tag, implicit sequence start and end, along with style.
See Psych::Handler#start_sequence
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'ext/psych/psych_emitter.c', line 331
static VALUE start_sequence(
VALUE self,
VALUE anchor,
VALUE tag,
VALUE implicit,
VALUE style
) {
yaml_emitter_t * emitter;
yaml_event_t event;
rb_encoding * encoding = rb_utf8_encoding();
if(!NIL_P(anchor)) {
Check_Type(anchor, T_STRING);
anchor = rb_str_export_to_enc(anchor, encoding);
}
if(!NIL_P(tag)) {
Check_Type(tag, T_STRING);
tag = rb_str_export_to_enc(tag, encoding);
}
TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
yaml_sequence_start_event_initialize(
&event,
(yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
(yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
implicit ? 1 : 0,
(yaml_sequence_style_t)NUM2INT(style)
);
emit(emitter, &event);
return self;
}
|