Skip to content

Commit

Permalink
Add String#dump method.
Browse files Browse the repository at this point in the history
  • Loading branch information
monaka committed Mar 7, 2013
1 parent cdd41a3 commit 63a56dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mrbgems/mruby-string-ext/src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ mrb_mruby_string_ext_gem_init(mrb_state* mrb)
{
struct RClass * s = mrb->string_class;

mrb_define_method(mrb, s, "getbyte", mrb_str_getbyte, ARGS_REQ(1));
mrb_define_method(mrb, s, "dump", mrb_str_dump, ARGS_NONE());
mrb_define_method(mrb, s, "getbyte", mrb_str_getbyte, ARGS_REQ(1));
}

void
Expand Down
3 changes: 3 additions & 0 deletions mrbgems/mruby-string-ext/test/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
assert_equal bytes2[0], str2.getbyte(0)
end

assert('String#dump') do
"foo".dump == "\"foo\""
end

0 comments on commit 63a56dd

Please sign in to comment.