method
new
v2_5_5 -
Show latest stable
- Class:
Psych::Emitter
new(p1, p2 = v2)public
Create a new Psych::Emitter that writes to io.
static VALUE initialize(int argc, VALUE *argv, VALUE self)
{
yaml_emitter_t * emitter;
VALUE io, options;
VALUE line_width;
VALUE indent;
VALUE canonical;
TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
if (rb_scan_args(argc, argv, "11", &io, &options) == 2) {
line_width = rb_funcall(options, id_line_width, 0);
indent = rb_funcall(options, id_indentation, 0);
canonical = rb_funcall(options, id_canonical, 0);
yaml_emitter_set_width(emitter, NUM2INT(line_width));
yaml_emitter_set_indent(emitter, NUM2INT(indent));
yaml_emitter_set_canonical(emitter, Qtrue == canonical ? 1 : 0);
}
rb_ivar_set(self, id_io, io);
yaml_emitter_set_output(emitter, writer, (void *)self);
return self;
} Related methods
- Instance methods
- alias
- canonical
- canonical=
- end_document
- end_mapping
- end_sequence
- end_stream
- indentation
- indentation=
- line_width
- line_width=
- scalar
- start_document
- start_mapping
- start_sequence
- start_stream
- Class methods
- new