Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

__send__ should not pass #1

jwo opened this Issue Jun 14, 2012 · 1 comment


None yet
2 participants

jwo commented Jun 14, 2012

I implemented RubyCop for http://rubyfiddle.com and had someone point out this code that can do stuffs.

If I use "send" versus "send" it fails, but with this __send__ (that I have never seen before myself), it passed.

def const( sym ) 
   self.class.__send__ :const_get, sym 

const(:File).read '/etc/passwd' 

I'm thinking it should just be added to CALL_BLACKLIST in https://github.com/envylabs/RubyCop/blob/master/lib/ruby_cop/policy.rb#L64 ... but I don't know the code set as well as you guys. Thoughts? I can do a PR with a test if that looks good for implementation.


omghax commented Jun 16, 2012

Yep, you're right, I forgot that __send__ was an alias for send. Ruby 1.9 also has public_send, which also shouldn't be allowed. I'll push out a fix for these shortly. Thanks for the heads up :)

@omghax omghax closed this in 4d76f0c Jun 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment