Method: Socket::Option#byte
- Defined in:
- option.c
#byte ⇒ Integer
211 212 213 214 215 216 217 218 219 220 221 |
# File 'option.c', line 211
static VALUE
sockopt_byte(VALUE self)
{
unsigned char i;
VALUE data = sockopt_data(self);
StringValue(data);
if (RSTRING_LEN(data) != sizeof(i))
rb_raise(rb_eTypeError, "size differ. expected as sizeof(int)=%d but %ld",
(int)sizeof(i), (long)RSTRING_LEN(data));
return CHR2FIX(*RSTRING_PTR(data));
}
|