Ruby variable name with double underscores Ruby variable name with double underscores ruby ruby

Ruby variable name with double underscores


An initial underscore or double underscore basically indicates "special/avoid overwrite" --meaning it's meant to reduce the likelihood that someone else might define a method/attribute of the same name. The most common occurrence is __send__.

From Ruby Forum


The author of the ElasticSearch gem made the wrong call IMO. At the end of the thread, Avdi Grimm, who is well-known in the Ruby community, disagrees with the OP.

There's a reason you hadn't seen it yet and that it looks odd to you. It's because it's unidiomatic.