Class: RTree::StyleC

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.json_read(io_obj) ⇒ Object



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'ext/rtree/rtree.c', line 457

static VALUE st_json_read(VALUE cls, VALUE io_obj)
{
  Check_Type(io_obj, T_FILE);

  rb_io_t *io;
  GetOpenFile(io_obj, io);
  rb_io_check_initialized(io);
  rb_io_check_readable(io);
  FILE *fp = rb_io_stdio_file(io);

  style_t *style;
  errno = 0;

  if ((style = postscript_style_read(fp)) == NULL)
    {
      if (errno)
        rb_sys_fail(__func__);
      else
        rb_raise(rb_eRuntimeError, "Failed read from stream");
    }

  return TypedData_Wrap_Struct(cls, &style_type, style);
}

Instance Method Details

#freeObject



449
450
451
452
453
454
455
# File 'ext/rtree/rtree.c', line 449

static VALUE st_release(VALUE self)
{
  style_t *style;
  TypedData_Get_Struct(self, style_t, &style_type, style);
  postscript_style_destroy(style);
  return self;
}