Sha256: 371d31e8b1010b1723ca8222a8305958b20be1acefb2ddcbe1d38cbf46582a3d

Contents?: true

Size: 771 Bytes

Versions: 2

Compression:

Stored size: 771 Bytes

Contents

#include <qrtools_qrcode.h>

static VALUE width(VALUE self)
{
  QRcode * code;
  Data_Get_Struct(self, QRcode, code);
  return INT2NUM(code->width);
}

static VALUE version(VALUE self)
{
  QRcode * code;
  Data_Get_Struct(self, QRcode, code);
  return INT2NUM(code->version);
}

static VALUE data(VALUE self)
{
  QRcode * code;
  Data_Get_Struct(self, QRcode, code);

  return rb_str_new(code->data, code->width * code->width);
}

VALUE cQRToolsQRCode;
void init_qrtools_qrcode()
{
  VALUE qrtools = rb_define_module("QRTools");
  VALUE klass   = rb_define_class_under(qrtools, "QRCode", rb_cObject);

  cQRToolsQRCode = klass;

  rb_define_method(klass, "width", width, 0);
  rb_define_method(klass, "version", version, 0);
  rb_define_method(klass, "data", data, 0);
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qrtools-1.0.1 ext/qrtools/qrtools_qrcode.c
qrtools-1.0.0 ext/qrtools/qrtools_qrcode.c