@@ -31,7 +31,7 @@ typedef struct JSON_Generator_StateStruct {
3131#define RB_UNLIKELY (cond ) (cond)
3232#endif
3333
34- static VALUE mJSON , cState , cFragment , mString_Extend , eGeneratorError , eNestingError , Encoding_UTF_8 ;
34+ static VALUE mJSON , cState , cFragment , eGeneratorError , eNestingError , Encoding_UTF_8 ;
3535
3636static ID i_to_s , i_to_json , i_new , i_pack , i_unpack , i_create_id , i_extend , i_encode ;
3737static VALUE sym_indent , sym_space , sym_space_before , sym_object_nl , sym_array_nl , sym_max_nesting , sym_allow_nan ,
@@ -835,18 +835,6 @@ static VALUE mFloat_to_json(int argc, VALUE *argv, VALUE self)
835835 return cState_partial_generate (Vstate , self , generate_json_float , Qfalse );
836836}
837837
838- /*
839- * call-seq: String.included(modul)
840- *
841- * Extends _modul_ with the String::Extend module.
842- */
843- static VALUE mString_included_s (VALUE self , VALUE modul )
844- {
845- VALUE result = rb_funcall (modul , i_extend , 1 , mString_Extend );
846- rb_call_super (1 , & modul );
847- return result ;
848- }
849-
850838/*
851839 * call-seq: to_json(*)
852840 *
@@ -861,51 +849,6 @@ static VALUE mString_to_json(int argc, VALUE *argv, VALUE self)
861849 return cState_partial_generate (Vstate , self , generate_json_string , Qfalse );
862850}
863851
864- /*
865- * call-seq: to_json_raw_object()
866- *
867- * This method creates a raw object hash, that can be nested into
868- * other data structures and will be generated as a raw string. This
869- * method should be used, if you want to convert raw strings to JSON
870- * instead of UTF-8 strings, e. g. binary data.
871- */
872- static VALUE mString_to_json_raw_object (VALUE self )
873- {
874- VALUE ary ;
875- VALUE result = rb_hash_new ();
876- rb_hash_aset (result , rb_funcall (mJSON , i_create_id , 0 ), rb_class_name (rb_obj_class (self )));
877- ary = rb_funcall (self , i_unpack , 1 , rb_str_new2 ("C*" ));
878- rb_hash_aset (result , rb_utf8_str_new_lit ("raw" ), ary );
879- return result ;
880- }
881-
882- /*
883- * call-seq: to_json_raw(*args)
884- *
885- * This method creates a JSON text from the result of a call to
886- * to_json_raw_object of this String.
887- */
888- static VALUE mString_to_json_raw (int argc , VALUE * argv , VALUE self )
889- {
890- VALUE obj = mString_to_json_raw_object (self );
891- Check_Type (obj , T_HASH );
892- return mHash_to_json (argc , argv , obj );
893- }
894-
895- /*
896- * call-seq: json_create(o)
897- *
898- * Raw Strings are JSON Objects (the raw bytes are stored in an array for the
899- * key "raw"). The Ruby String can be created by this module method.
900- */
901- static VALUE mString_Extend_json_create (VALUE self , VALUE o )
902- {
903- VALUE ary ;
904- Check_Type (o , T_HASH );
905- ary = rb_hash_aref (o , rb_str_new2 ("raw" ));
906- return rb_funcall (ary , i_pack , 1 , rb_str_new2 ("C*" ));
907- }
908-
909852/*
910853 * call-seq: to_json(*)
911854 *
@@ -2091,13 +2034,7 @@ void Init_generator(void)
20912034 rb_define_method (mFloat , "to_json" , mFloat_to_json , -1 );
20922035
20932036 VALUE mString = rb_define_module_under (mGeneratorMethods , "String" );
2094- rb_define_singleton_method (mString , "included" , mString_included_s , 1 );
20952037 rb_define_method (mString , "to_json" , mString_to_json , -1 );
2096- rb_define_method (mString , "to_json_raw" , mString_to_json_raw , -1 );
2097- rb_define_method (mString , "to_json_raw_object" , mString_to_json_raw_object , 0 );
2098-
2099- mString_Extend = rb_define_module_under (mString , "Extend" );
2100- rb_define_method (mString_Extend , "json_create" , mString_Extend_json_create , 1 );
21012038
21022039 VALUE mTrueClass = rb_define_module_under (mGeneratorMethods , "TrueClass" );
21032040 rb_define_method (mTrueClass , "to_json" , mTrueClass_to_json , -1 );
0 commit comments