Class: ChunkIO::Context

Inherits:
Object
  • Object
show all
Defined in:
ext/chunkio/chunkio_context.c

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'ext/chunkio/chunkio_context.c', line 40

static VALUE chunkio_context_initialize(VALUE self, VALUE root)
{
    char *p = RSTRING_PTR(root);
    /* struct cio_ctx *ctx = cio_create(p, log_cb, CIO_DEBUG, 0); /\* TODO: flags, LOG *\/ */
    struct cio_ctx *ctx = cio_create(p, NULL, CIO_DEBUG, 0); /* TODO: flags, LOG */
    if (!ctx) {
        rb_raise(rb_eStandardError, "failed to create cio_ctx");
    }
    DATA_PTR(self) = ctx;
    return Qnil;
}

Instance Method Details

#root_pathObject



52
53
54
55
56
57
58
# File 'ext/chunkio/chunkio_context.c', line 52

static VALUE chunkio_context_root_path(VALUE self)
{
    struct cio_ctx *ctx;
    TypedData_Get_Struct(self, struct cio_ctx, &chunkio_context_type, ctx);

    return rb_str_new2(ctx->root_path);
}