summaryrefslogtreecommitdiff
path: root/ext/-test-/string
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-30 04:01:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-30 04:01:58 +0000
commitf989f7c7ea89bb0b4a120666f5e85c0a81c9b44c (patch)
tree4103aa778fddb2ac2c431b1c555fe51be7b7fa0c /ext/-test-/string
parent4dcc883d06cdc0f933fe83f307c7c6a5c1e41d05 (diff)
* string.c (rb_str_ellipsize): new function to ellipsize a string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-/string')
-rw-r--r--ext/-test-/string/ellipsize.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/-test-/string/ellipsize.c b/ext/-test-/string/ellipsize.c
new file mode 100644
index 0000000..0451519
--- /dev/null
+++ b/ext/-test-/string/ellipsize.c
@@ -0,0 +1,13 @@
+#include "ruby.h"
+
+static VALUE
+bug_str_ellipsize(VALUE str, VALUE len)
+{
+ return rb_str_ellipsize(str, NUM2LONG(len));
+}
+
+void
+Init_ellipsize(VALUE klass)
+{
+ rb_define_method(klass, "ellipsize", bug_str_ellipsize, 1);
+}