@@ -241,33 +241,15 @@ static VALUE protected_event_location(VALUE pointer)
241241 return rb_funcall3 (args [0 ], id_event_location , 4 , args + 1 );
242242}
243243
244- /*
245- * call-seq:
246- * parser.parse(yaml)
247- *
248- * Parse the YAML document contained in +yaml+. Events will be called on
249- * the handler set on the parser instance.
250- *
251- * See Psych::Parser and Psych::Parser#handler
252- */
253- static VALUE parse (int argc , VALUE * argv , VALUE self )
244+ static VALUE parse (VALUE self , VALUE handler , VALUE yaml , VALUE path )
254245{
255- VALUE yaml , path ;
256246 yaml_parser_t * parser ;
257247 yaml_event_t event ;
258248 int done = 0 ;
259249 int state = 0 ;
260250 int parser_encoding = YAML_ANY_ENCODING ;
261251 int encoding = rb_utf8_encindex ();
262252 rb_encoding * internal_enc = rb_default_internal_encoding ();
263- VALUE handler = rb_iv_get (self , "@handler" );
264-
265- if (rb_scan_args (argc , argv , "11" , & yaml , & path ) == 1 ) {
266- if (rb_respond_to (yaml , id_path ))
267- path = rb_funcall (yaml , id_path , 0 );
268- else
269- path = rb_str_new2 ("<unknown>" );
270- }
271253
272254 TypedData_Get_Struct (self , yaml_parser_t , & psych_parser_type , parser );
273255
@@ -558,7 +540,7 @@ void Init_psych_parser(void)
558540
559541 rb_require ("psych/syntax_error" );
560542
561- rb_define_method (cPsychParser , "parse " , parse , -1 );
543+ rb_define_private_method (cPsychParser , "_native_parse " , parse , 3 );
562544 rb_define_method (cPsychParser , "mark" , mark , 0 );
563545
564546 id_read = rb_intern ("read" );
0 commit comments