What does the “$” character mean in Ruby?
$ identifies a global variable, as opposed to a local variable, @instance variable, or @@class variable. Among the language-supplied global variables are $:, which is also identified by $LOAD_PATH
$ identifies a global variable, as opposed to a local variable, @instance variable, or @@class variable. Among the language-supplied global variables are $:, which is also identified by $LOAD_PATH
The Ruby load path is very commonly seen written as $: , but just because it is short, does not make it better. If you prefer clarity to cleverness, or if brevity for its own sake makes you itchy, you needn’t do it just because everyone else is. Say hello to … $LOAD_PATH … and … Read more
It was deemed a “security” risk. You can get around it by using absolute paths File.expand_path(__FILE__) et al or doing require ‘./filename’ (ironically). or by using require_relative ‘filename’ or adding an “include” directory ruby -I . … or the same, using irb; $irb -I .