How do you find information (via Google, preferably) about the usage of operators in code? In this case, I want to find the meaning of this code in Ruby.
x = [1,2,3]
x.send :[]=,0,2
x[0] + x.[](1) + x.send(:[],2)
I want you to teach me how to fish -- do not tell me what the operators do. When I go to Google and try to search for the notation, I get examples or tutorials that don't cover the particular usage.
https://stackoverflow.com/questions/1165786/how-to-search-for-punctuation-that-gets-ignored-by-google says that Google dismisses such notation; the way that I'm looking for an "answer" is to ask for at least one successful walkthrough from someone that can take the above code and say "Here is how I find out what the operators do".
Example of my unsuccessful searches.
I search for Ruby :[]= and add/remove terms like notation, operator, colon, bracket, square brackets, and can't find usage of these operators in this way.
I search for ruby . notation, add/remove terms like period, dot, parenthesis, etc.
I search for cheat sheets. Find the cheat sheet to Ruby on Rails default directory structure, regex expressions, etc., but still not what I'm looking for.
It's so hard not to tell you (I will if you ask).
Get a Ruby book. Try the Pickaxe, it has an entire section on Ruby operators, metaprograming, language reference, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With