What does the “$” character mean in Ruby?

前端 未结 5 1650
深忆病人
深忆病人 2020-12-08 01:40

Been playing with Ruby on Rails for awhile and decided to take a look through the actual source. Grabbed the repo from GitHub and started looking around. Came across some co

5条回答
  •  情书的邮戳
    2020-12-08 02:26

    $:.unshift
    

    is the same as

    $LOAD_PATH.unshift
    

    . You can also say:

    $: <<
    $LOAD_PATH <<
    

    They are pretty common Ruby idioms to set a load path.

提交回复
热议问题