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



520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'ext/ibm_db.c', line 520

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 );
  }
}