Ejemplo n.º 1
0
/*
 * call-seq:
 * entry.inspect  => String
 *
 * Produce a concise representation of the entry.
 */
VALUE
rb_ldap_entry_inspect (VALUE self)
{
  VALUE str;
  const char *c;

  c = rb_obj_classname (self);
  str = rb_str_new (0, strlen (c) + 10 + 16 + 1);	/* 10:tags 16:addr 1:nul */
  sprintf (RSTRING_PTR (str), "#<%s:0x%lx\n", c, self);

#if RUBY_VERSION_CODE < 190
  RSTRING(str)->len = strlen (RSTRING_PTR (str));
#else
  rb_str_set_len(str, strlen (RSTRING_PTR (str)));
#endif

  rb_str_concat (str, rb_inspect (rb_ldap_entry_to_hash (self)));
  rb_str_cat2 (str, ">");

  return str;
}
Ejemplo n.º 2
0
/*
 * call-seq:
 * LDAP.entry2hash(entry)  => Hash
 *
 * Convert the entry, +entry+, to a hash.
 */
VALUE
rb_ldap_entry2hash (VALUE self, VALUE entry)
{
  return rb_ldap_entry_to_hash (entry);
}