~> とは?
Gemfile や gemspec で依存 gem のバージョン指定をする際に指定される記法。
Ruby's Pessimistic Operator - Giant Robots Smashing into Other Giant Robots
様々な呼び方
- pessimistic comparison operator
- twiddle-wakka
- approximate
- spermy
ググってみると pessimistic (comparison) operator と呼んでいる人が多い。
RubyGemsのドキュメントでは twiddle-wakka になっている。
RubyGemsのソースコードでは approximate になっている。
approximate に変更する前は spermy になっていた。名前が微妙なので変えたようだ。
まぁ、たしかに見た目は・・・いや、しかし・・・。
成り立ち
Jim Weirich 氏によって >* という書式で追加されたあとに ~> に変更された。
コミットコメントをみると当時は pessimistic operator と名付けていたようだ。
- commit eacba214b5d815e82d0ab0c09a7ac378e004898e - RubyGems
- commit b9d09b19571b6b884fba3384c98f41acd4c5e755 - RubyGems
- Why is twiddle wakka designed like this? - stackoverflow
便利ツール
外部資料
- Change references to 'spermy' to 'twiddle wakka' #123 - issues - rubygems/rubygems - GitHub1
- Replace usage of the term "spermy" with "approximate".
- Declaring dependencies - PATTERNS - Guide - RubyGems
- Ruby's Pessimistic Operator - Giant Robots Smashing into Other Giant Robots
- Why is twiddle wakka designed like this? - stackoverflow