1
0
mirror of https://github.com/funamitech/mastodon synced 2024-11-24 07:06:34 +09:00

TIL a return from a block seems to return from the whole method rather than

the block, even though the last line of a block is an implicit return. I am
confused to say the least
This commit is contained in:
Eugen Rochko 2016-03-19 00:23:46 +01:00
parent 071f64d317
commit 47d1cb4e21

View File

@ -19,7 +19,7 @@ module ApplicationHelper
auto_link(coder.encode(status.text), link: :urls, html: { rel: 'nofollow noopener' }).gsub(Account::MENTION_RE) do |m|
account = mention_hash[Account::MENTION_RE.match(m)[1]]
return "#{m.split('@').first}<a href=\"#{url_for_target(account)}\" class=\"mention\">@<span>#{account.acct}</span></a>"
"#{m.split('@').first}<a href=\"#{url_for_target(account)}\" class=\"mention\">@<span>#{account.acct}</span></a>"
end.html_safe
end