freebsd-ports/devel/ruby-locale/files/patch-ab
Mark Linimon 60baa01555 Added Locale.get method.
PR:		ports/68172
Submitted by:	Alexander Novitsky <alecn2002 at yandex dot ru>
Approved by:	maintainer
2004-09-03 19:44:01 +00:00

27 lines
659 B
Text

--- rblocale.c.orig Fri Apr 14 08:20:58 2000
+++ rblocale.c Mon Jun 21 20:36:37 2004
@@ -31,6 +31,16 @@
return ret == NULL ? Qnil : rb_str_new2(ret);
}
+VALUE
+locale_get( self, category )
+ VALUE self, category;
+{
+ char *ret;
+
+ ret = setlocale(NUM2INT(category), NULL );
+ return ret == NULL ? Qnil : rb_str_new2(ret);
+}
+
void Init_locale()
{
char *curr_locale;
@@ -44,6 +54,7 @@
}
rb_define_module_function(mLocale, "set", locale_set, 2);
+ rb_define_module_function(mLocale, "get", locale_get, 1);
rb_define_const(mLocale, "ALL", INT2FIX(LC_ALL));
rb_define_const(mLocale, "COLLATE", INT2FIX(LC_COLLATE));