Class: Plamo::HttpQuery

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

Instance Method Summary collapse

Constructor Details

#initializeObject



25
26
27
28
# File 'ext/plamo/plamo_http_query.c', line 25

static VALUE initialize(VALUE self) {
  DATA_PTR(self) = plamo_http_query_new();
  return self;
}

Instance Method Details

#[](key) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'ext/plamo/plamo_http_query.c', line 37

static VALUE get(VALUE self, VALUE key) {
  PlamoHttpQuery *plamo_http_query;
  TypedData_Get_Struct(self, PlamoHttpQuery, &rb_plamo_http_query_type, plamo_http_query);
  PlamoStringArray *plamo_string_array = plamo_http_query_get(plamo_http_query, StringValueCStr(key));
  if (plamo_string_array != NULL) {
    VALUE rb_plamo_string_array = TypedData_Wrap_Struct(rb_cPlamoStringArray, &rb_plamo_string_array_type, plamo_string_array);
    return rb_plamo_string_array;
  } else {
    return Qnil;
  }
}

#delete(key) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'ext/plamo/plamo_http_query.c', line 49

static VALUE delete_at(VALUE self, VALUE key) {
  PlamoHttpQuery *plamo_http_query;
  TypedData_Get_Struct(self, PlamoHttpQuery, &rb_plamo_http_query_type, plamo_http_query);
  if (plamo_http_query_remove(plamo_http_query, StringValueCStr(key))) {
    return Qtrue;
  } else {
    return Qfalse;
  }
}

#push(key, value) ⇒ Object



30
31
32
33
34
35
# File 'ext/plamo/plamo_http_query.c', line 30

static VALUE push(VALUE self, VALUE key, VALUE value) {
  PlamoHttpQuery *plamo_http_query;
  TypedData_Get_Struct(self, PlamoHttpQuery, &rb_plamo_http_query_type, plamo_http_query);
  plamo_http_query_add(plamo_http_query, StringValueCStr(key), StringValueCStr(value));
  return Qnil;
}