Method: Aspell#correct_file
- Defined in:
- ext/raspell.c
#correct_file(filename) ⇒ Object
Simple utility function to correct a file. The file gets read, content will be checked and write back. Please note: This method will change the file! - no backup and of course: no warranty!
584 585 586 587 588 589 590 591 592 593 594 595 596 |
# File 'ext/raspell.c', line 584 static VALUE aspell_correct_file(VALUE self, VALUE filename) { if (rb_block_given_p()) { VALUE content = rb_funcall(rb_cFile, rb_intern("readlines"), 1, filename); VALUE newcontent = aspell_correct_lines(self, content); VALUE file = rb_file_open(StringValuePtr(filename), "w+"); rb_funcall(file, rb_intern("write"), 1, newcontent); rb_funcall(file, rb_intern("close"), 0); } else { rb_raise(cAspellError, "No block given. How to correct?"); } return self; } |