1

In Ruby, what does this mean?

Order.__elasticsearch__.create_index! force: true

Is that a method? What's different about it when it has the underscore on both sides?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
BC00
  • 1,589
  • 3
  • 29
  • 47

1 Answers1

1

It's just a method. There's nothing intrinsically special about it in Ruby; it's kind of a Pythonic way of indicating a method/attribute that's internal to the Order object and shouldn't be messed with. It also reduces the chances that someone will overwrite it by accident.

Community
  • 1
  • 1
Alex P
  • 5,942
  • 2
  • 23
  • 30
  • Fyi, for languages other than Python the term is "idiomatic". Or were you specifically trying to say that this is something idiomatic in Python? – Ajedi32 Jun 24 '14 at 01:22
  • @Ajedi32 It's a common Python practice, but certainly not idiomatic Ruby (`__send__` notwithstanding). – Mark Thomas Jun 24 '14 at 02:46