[ruby-mode] Avoid inserting end tag for if and do in the middle of a word.

This fixes problems when an insertion is triggered by `ver[if]ication`
and `[do]wnload`. Here is a list of examples:

Before:

```ruby
verif|
end

bado|
end

do|
end

test do|
end

if|
end
```

After:

```ruby
verif|

bado|

do|

test do|
end

if|
end
```