Class: IBM_DB::RowObject

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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object

allow direct access to hash object as object attributes



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'ext/ibm_db.c', line 483

VALUE ibm_db_row_object(int argc, VALUE *argv, VALUE self)
{
  row_hash_struct *row_res;
  VALUE symbol;
  VALUE rest;
  VALUE index;

    Data_Get_Struct(self, row_hash_struct, row_res);

  rb_scan_args(argc, argv, "1*", &symbol, &rest);

  if (symbol == ID2SYM(id_keys)) {
      return rb_funcall(row_res->hash, id_keys, 0);
  } else {
      index = rb_funcall(symbol, id_id2name, 0);
      return rb_hash_aref(row_res->hash, index);
  }
}