Class: Plamo::FormUrlencoded

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

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Object



25
26
27
28
29
30
# File 'ext/plamo/plamo_form_urlencoded.c', line 25

static VALUE initialize(VALUE self, VALUE request) {
  PlamoRequest *plamo_request;
  TypedData_Get_Struct(request, PlamoRequest, &rb_plamo_request_type, plamo_request);
  DATA_PTR(self) = plamo_form_urlencoded_new(plamo_request);
  return self;
}

Instance Method Details

#[](key) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'ext/plamo/plamo_form_urlencoded.c', line 32

static VALUE get(VALUE self, VALUE key) {
  PlamoFormUrlencoded *plamo_form_urlencoded;
  TypedData_Get_Struct(self, PlamoFormUrlencoded, &rb_plamo_form_urlencoded_type, plamo_form_urlencoded);
  const PlamoStringArray *plamo_string_array = plamo_form_urlencoded_get(plamo_form_urlencoded, StringValueCStr(key));
  if (plamo_string_array != NULL) {
    VALUE rb_plamo_string_array = TypedData_Wrap_Struct(rb_cPlamoStringArray, &rb_plamo_string_array_type, (PlamoStringArray*)plamo_string_array);
    OBJ_FREEZE(rb_plamo_string_array);
    return rb_plamo_string_array;
  } else {
    return Qnil;
  }
}

#eachObject



49
50
51
52
53
54
# File 'ext/plamo/plamo_form_urlencoded.c', line 49

static VALUE each(VALUE self) {
  PlamoFormUrlencoded *plamo_form_urlencoded;
  TypedData_Get_Struct(self, PlamoFormUrlencoded, &rb_plamo_form_urlencoded_type, plamo_form_urlencoded);
  plamo_form_urlencoded_for_each(plamo_form_urlencoded, execute_each);
  return Qnil;
}