329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
# File 'ext/archive_r/archive_r_ext.cc', line 329
static VALUE stream_initialize(int argc, VALUE *argv, VALUE self) {
RubyStreamWrapper *wrapper = get_stream_wrapper(self);
if (wrapper->stream) {
rb_raise(rb_eRuntimeError, "Stream already initialized");
}
VALUE hierarchy_value = Qnil;
VALUE opts = Qnil;
rb_scan_args(argc, argv, "11", &hierarchy_value, &opts);
PathHierarchy hierarchy = rb_value_to_path_hierarchy(hierarchy_value);
std::optional<bool> seekable_override;
if (!NIL_P(opts)) {
Check_Type(opts, T_HASH);
static ID id_seekable = rb_intern("seekable");
VALUE seekable_value = rb_hash_aref(opts, ID2SYM(id_seekable));
if (!NIL_P(seekable_value)) {
seekable_override = RTEST(seekable_value);
}
}
wrapper->stream = std::make_shared<RubyUserStream>(self, std::move(hierarchy), seekable_override);
return self;
}
|