Use send only where necessary
Created by: cirosantilli
Prefer public_send if methods are public, and method calls if the method is a constant symbol.
public_send
mentioned in bbatsov: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
Under app
and lib
:
find . -iname "*.rb" | xargs perl -lapi -e 's/\.send\b/.public_send/'
but some manual refactor was also done in addition.
Exceptions:
-
self.send
and justsend
. I movedself.send
to justsend
for uniformity and to avoid hound barks. In those cases, the call can access private methods, so it does not matter. - at
lib/redcarpet/render/gitlab_html
there is anh.send
which causes problems is replaced... seems like we are using something we shouldn't.