Class: JQ::Core

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

Instance Method Summary collapse

Instance Method Details

#closeObject



46
47
48
49
50
51
52
53
54
55
56
# File 'ext/jq_core.c', line 46

static VALUE rb_jq_close(VALUE self) {
  struct jq_container *p;
  Data_Get_Struct(self, struct jq_container, p);

  if (!p->closed) {
    jq_teardown(&p->jq);
    p->closed = 1;
  }

  return Qnil;
}

#update(buf, is_partial) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'ext/jq_core.c', line 103

static VALUE rb_jq_update(VALUE self, VALUE buf, VALUE is_partial) {
  struct jq_container *p;

  if (!rb_block_given_p()) {
    rb_raise(rb_eArgError, "no block given");
  }

  Data_Get_Struct(self, struct jq_container, p);
  Check_Type(buf, T_STRING);
  jq_parse(p->jq, RSTRING_PTR(buf), is_partial ? 1 : 0, rb_yield);

  return Qnil;
}