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



664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
# File 'ext/ibm_db.c', line 664

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