Sora's suggestion works, but doesn't explain what is going on. The
reason is that the variable (@def) is a string the first time around,
but after the first split it becomes an array because that's what
split returns. You can convert it back to a string after the shift
with to_s or join, like so:

definition = definition.to_s

or

definition = definition.join(' ')

Adding a '=' essential calls to_s on the array.

By the way, def is a reserved keyword, I would avoid using it as a
variable name, especially since there are better choices.

HTH,
Ammar

On Tue, Jun 15, 2010 at 1:45 AM, Sora Harakami <sora134 / gmail.com> wrote:
> On Tue, Jun 15, 2010 at 7:19 AM, Jennifer Lee <jmasonlee / gmail.com> wrote:
>> I have code:
>>
>> <% @terms.each do |term| %>>
>>
>> <%regex = Regexp.new(/#{term}/)%>
>> <%matchdata = regex.match(@def_str)%>
>> <%if matchdata%>
>>
>>  <% @def = @def.split(/#{term}/) %>
>>  <% @def.shift %>
>>
>> <%end%>
>> <%end%>
>
> Hi,
>
>>  <% @def.shift %>
> This line is run only and doesn't output value.
>
> So change this line to: <%= @def.shift %>
> to solve this problem.
>
> Thanks.
>
> --
> Sora Harakami - @sora_h
> Blog: http://codnote.net/
> Detail: http://sorah.cosmio.net/
>
>