add net_scope_to_string ruby wrapper

This commit is contained in:
Doug MacEachern 2009-07-29 16:08:16 -07:00
parent ffd7609c12
commit e2bb79ca1c
1 changed files with 7 additions and 0 deletions

View File

@ -197,6 +197,11 @@ static VALUE rb_sigar_net_address_to_string(sigar_net_address_t *address)
return rb_str_new2(addr_str); return rb_str_new2(addr_str);
} }
static VALUE rb_sigar_net_scope_to_s(VALUE rclass, VALUE type)
{
return rb_str_new2(sigar_net_scope_to_string(NUM2INT(type)));
}
#define rb_sigar_net_address_to_s(a) rb_sigar_net_address_to_string(&a) #define rb_sigar_net_address_to_s(a) rb_sigar_net_address_to_string(&a)
static VALUE rb_sigar_new_list(char *data, unsigned long number, static VALUE rb_sigar_new_list(char *data, unsigned long number,
@ -751,6 +756,8 @@ void Init_rbsigar(void)
rb_define_singleton_method(rclass, "format_size", rb_sigar_format_size, 1); rb_define_singleton_method(rclass, "format_size", rb_sigar_format_size, 1);
rb_define_singleton_method(rclass, "net_interface_flags_to_s", rb_define_singleton_method(rclass, "net_interface_flags_to_s",
rb_sigar_net_interface_flags_to_s, 1); rb_sigar_net_interface_flags_to_s, 1);
rb_define_singleton_method(rclass, "net_scope_to_s",
rb_sigar_net_scope_to_s, 1);
rb_define_singleton_method(rclass, "net_connection_type_to_s", rb_define_singleton_method(rclass, "net_connection_type_to_s",
rb_sigar_net_connection_type_to_s, 1); rb_sigar_net_connection_type_to_s, 1);
rb_define_singleton_method(rclass, "net_connection_state_to_s", rb_define_singleton_method(rclass, "net_connection_state_to_s",