From: Eugen Rochko Date: Fri, 18 Mar 2016 23:23:46 +0000 (+0100) Subject: TIL a return from a block seems to return from the whole method rather than X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=47d1cb4e2183949e50488187a74e3ce9b3d7d3b8;p=mastodon.git 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 --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 56207c4bb..dad7ed349 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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}@#{account.acct}" + "#{m.split('@').first}@#{account.acct}" end.html_safe end