Class: RNV::Error
- Inherits:
-
Object
- Object
- RNV::Error
- Defined in:
- ext/rnv/ruby_rnv.c
Instance Attribute Summary collapse
-
#code ⇒ Symbol
readonly
error symbol code.
-
#col ⇒ Integer
readonly
error column.
-
#line ⇒ Integer
readonly
error line.
-
#message ⇒ String
readonly
error message.
Instance Method Summary collapse
Instance Attribute Details
#code ⇒ Symbol (readonly)
error symbol code
#col ⇒ Integer (readonly)
error column
#line ⇒ Integer (readonly)
error line
#message ⇒ String (readonly)
error message
Instance Method Details
#inspect ⇒ String
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'ext/rnv/ruby_rnv.c', line 323
VALUE rb_error_inspect(VALUE self)
{
VALUE code = rb_iv_get(self, "@code");
VALUE message = rb_iv_get(self, "@message");
VALUE expected = rb_iv_get(self, "@expected");
VALUE line = rb_iv_get(self, "@line");
VALUE col = rb_iv_get(self, "@col");
VALUE ret = rb_str_new2("#<RNV::Error ");
ret = rb_str_cat2(ret, "code: :");
ret = rb_str_append(ret, rb_obj_as_string(code));
ret = rb_str_cat2(ret, ", ");
ret = rb_str_cat2(ret, "message: '");
ret = rb_str_append(ret, message);
ret = rb_str_cat2(ret, "', ");
ret = rb_str_cat2(ret, "expected: '");
ret = rb_str_append(ret, expected);
ret = rb_str_cat2(ret, "', ");
ret = rb_str_cat2(ret, "line: ");
ret = rb_str_append(ret, rb_obj_as_string(line));
ret = rb_str_cat2(ret, ", ");
ret = rb_str_cat2(ret, "col: ");
ret = rb_str_append(ret, rb_obj_as_string(col));
ret = rb_str_cat2(ret, ">");
return ret;
}
|
#to_s ⇒ String
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'ext/rnv/ruby_rnv.c', line 353
VALUE rb_error_to_s(VALUE self)
{
VALUE message = rb_iv_get(self, "@message");
VALUE expected = rb_iv_get(self, "@expected");
VALUE line = rb_iv_get(self, "@line");
VALUE col = rb_iv_get(self, "@col");
VALUE ret = rb_str_new2("");
ret = rb_str_append(ret, rb_obj_as_string(line));
ret = rb_str_cat2(ret, ":");
ret = rb_str_append(ret, rb_obj_as_string(col));
ret = rb_str_cat2(ret, ": error: ");
ret = rb_str_append(ret, message);
ret = rb_str_cat2(ret, "\n");
ret = rb_str_append(ret, expected);
return ret;
}
|