Class: Vlerq::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/rural.rb,
ext/vlerq_ext.c

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



11
12
13
# File 'lib/rural.rb', line 11

def method_missing(m, *args)
  self[m.to_s]
end

Instance Method Details

#[]Object



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'ext/vlerq_ext.c', line 349

static VALUE row_aref_keep (VALUE self, VALUE index) {
  int col;
  Row_p p;
  View_p v;
  Item item;
  VALUE result;
  
  Data_Get_Struct(self, Row, p);
  Data_Get_Struct(p->view, Sequence, v);

  PUSH_KEEP_REFS
  
  if (TYPE(index) == T_FIXNUM)
    col = NUM2INT(index);
  else
    col = StringLookup(STR2CSTR(index), ViewCol(V_Meta(v), MC_name));
  
  Assert(col >= 0);
  item.c = ViewCol(v, col);
  result = ItemAsObj(GetItem(p->row, &item), &item);

  POP_KEEP_REFS
  return result;
}

#_iObject



40
41
42
43
44
# File 'ext/vlerq_ext.c', line 40

static VALUE row_i (VALUE self) {
  Row_p p;
  Data_Get_Struct(self, Row, p);
  return INT2NUM(p->row);
}

#_vObject



34
35
36
37
38
# File 'ext/vlerq_ext.c', line 34

static VALUE row_v (VALUE self) {
  Row_p p;
  Data_Get_Struct(self, Row, p);
  return p->view;
}