Class: Plamo::FormDataFieldArray

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

Instance Method Summary collapse

Instance Method Details

#[](index) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'ext/plamo/plamo_form_data_field_array.c', line 40

static VALUE get_at(VALUE self, VALUE index) {
  PlamoFormDataFieldArray *plamo_form_data_field_array;
  TypedData_Get_Struct(self, PlamoFormDataFieldArray, &rb_plamo_form_data_field_array_type, plamo_form_data_field_array);
  const PlamoFormDataField *plamo_form_data_field = plamo_form_data_field_array_get_at(plamo_form_data_field_array, NUM2SIZET(index));
  if (plamo_form_data_field) {
    VALUE rb_plamo_form_data_field = TypedData_Wrap_Struct(rb_cPlamoFormDataField, &rb_plamo_form_data_field_type, (PlamoFormDataField*)plamo_form_data_field);
    OBJ_FREEZE(rb_plamo_form_data_field);
    return rb_plamo_form_data_field;
  } else {
    return Qnil;
  }
}

#eachObject



33
34
35
36
37
38
# File 'ext/plamo/plamo_form_data_field_array.c', line 33

static VALUE each(VALUE self) {
  PlamoFormDataFieldArray *plamo_form_data_field_array;
  TypedData_Get_Struct(self, PlamoFormDataFieldArray, &rb_plamo_form_data_field_array_type, plamo_form_data_field_array);
  plamo_form_data_field_array_for_each(plamo_form_data_field_array, execute_each);
  return Qnil;
}

#firstObject



53
54
55
56
57
58
59
60
61
62
63
64
# File 'ext/plamo/plamo_form_data_field_array.c', line 53

static VALUE get_first(VALUE self) {
  PlamoFormDataFieldArray *plamo_form_data_field_array;
  TypedData_Get_Struct(self, PlamoFormDataFieldArray, &rb_plamo_form_data_field_array_type, plamo_form_data_field_array);
  const PlamoFormDataField *plamo_form_data_field = plamo_form_data_field_array_get_first(plamo_form_data_field_array);
  if (plamo_form_data_field) {
    VALUE rb_plamo_form_data_field = TypedData_Wrap_Struct(rb_cPlamoFormDataField, &rb_plamo_form_data_field_type, (PlamoFormDataField*)plamo_form_data_field);
    OBJ_FREEZE(rb_plamo_form_data_field);
    return rb_plamo_form_data_field;
  } else {
    return Qnil;
  }
}

#lastObject



66
67
68
69
70
71
72
73
74
75
76
77
# File 'ext/plamo/plamo_form_data_field_array.c', line 66

static VALUE get_last(VALUE self) {
  PlamoFormDataFieldArray *plamo_form_data_field_array;
  TypedData_Get_Struct(self, PlamoFormDataFieldArray, &rb_plamo_form_data_field_array_type, plamo_form_data_field_array);
  const PlamoFormDataField *plamo_form_data_field = plamo_form_data_field_array_get_last(plamo_form_data_field_array);
  if (plamo_form_data_field) {
    VALUE rb_plamo_form_data_field = TypedData_Wrap_Struct(rb_cPlamoFormDataField, &rb_plamo_form_data_field_type, (PlamoFormDataField*)plamo_form_data_field);
    OBJ_FREEZE(rb_plamo_form_data_field);
    return rb_plamo_form_data_field;
  } else {
    return Qnil;
  }
}

#lengthObject Also known as: size



21
22
23
24
25
# File 'ext/plamo/plamo_form_data_field_array.c', line 21

static VALUE length(VALUE self) {
  PlamoFormDataFieldArray *plamo_form_data_field_array;
  TypedData_Get_Struct(self, PlamoFormDataFieldArray, &rb_plamo_form_data_field_array_type, plamo_form_data_field_array);
  return SIZET2NUM(plamo_form_data_field_array_length(plamo_form_data_field_array));
}