= private = protected
join(p1 = v1)
Returns a string created by converting each element of the array to a string, separated by sep.
[ "a", "b", "c" ].join #=> "abc" [ "a", "b", "c" ].join("-") #=> "a-b-c"
static VALUE rb_ary_join_m(int argc, VALUE *argv, VALUE ary) { VALUE sep; rb_scan_args(argc, argv, "01", &sep); if (NIL_P(sep)) sep = rb_output_fs; return rb_ary_join(ary, sep); }
I use this in views when I need to join a array of objects from a sql request here is a basic version of what I mean.
<%= @blogs.map{ |blog| blog.comment }.join(“ | ”) %>