r scanner in ruby