@@ -245,33 +245,15 @@ static VALUE protected_event_location(VALUE pointer)
245245 return rb_funcall3 (args [0 ], id_event_location , 4 , args + 1 );
246246}
247247
248- /*
249- * call-seq:
250- * parser.parse(yaml)
251- *
252- * Parse the YAML document contained in +yaml+. Events will be called on
253- * the handler set on the parser instance.
254- *
255- * See Psych::Parser and Psych::Parser#handler
256- */
257- static VALUE parse (int argc , VALUE * argv , VALUE self )
248+ static VALUE parse (VALUE self , VALUE handler , VALUE yaml , VALUE path )
258249{
259- VALUE yaml , path ;
260250 yaml_parser_t * parser ;
261251 yaml_event_t event ;
262252 int done = 0 ;
263253 int state = 0 ;
264254 int parser_encoding = YAML_ANY_ENCODING ;
265255 int encoding = rb_utf8_encindex ();
266256 rb_encoding * internal_enc = rb_default_internal_encoding ();
267- VALUE handler = rb_iv_get (self , "@handler" );
268-
269- if (rb_scan_args (argc , argv , "11" , & yaml , & path ) == 1 ) {
270- if (rb_respond_to (yaml , id_path ))
271- path = rb_funcall (yaml , id_path , 0 );
272- else
273- path = rb_str_new2 ("<unknown>" );
274- }
275257
276258 TypedData_Get_Struct (self , yaml_parser_t , & psych_parser_type , parser );
277259
@@ -562,7 +544,7 @@ void Init_psych_parser(void)
562544
563545 rb_require ("psych/syntax_error" );
564546
565- rb_define_method (cPsychParser , "parse " , parse , -1 );
547+ rb_define_private_method (cPsychParser , "_native_parse " , parse , 3 );
566548 rb_define_method (cPsychParser , "mark" , mark , 0 );
567549
568550 id_read = rb_intern ("read" );
0 commit comments