Reputation: 453
When I read RbConfig::CONFIG['libdir']
it gives me lib folder location. But in rbconfig.rb file CONFIG["libdir"] = "$(exec_prefix)/lib"
. How the value is interpreted here.
Upvotes: 0
Views: 104
Reputation: 114208
$(exec_prefix)
refers to a key in RbConfig::CONFIG
.
But that's not a Ruby feature. rbconfig.rb
contains code to expand these values: every occurrence of $(key)
is replaced with the corresponding value of RbConfig::CONFIG['key']
My rbconfig.rb
contains these lines:
CONFIG["prefix"] = (TOPDIR || DESTDIR + "/Users/sos/.rubies/ruby-2.2.2")
CONFIG["exec_prefix"] = "$(prefix)"
CONFIG["libdir"] = "$(exec_prefix)/lib"
And their values are:
RbConfig::CONFIG["prefix"] #=> "/Users/sos/.rubies/ruby-2.2.2"
RbConfig::CONFIG["exec_prefix"] #=> "/Users/sos/.rubies/ruby-2.2.2"
RbConfig::CONFIG["libdir"] #=> "/Users/sos/.rubies/ruby-2.2.2/lib"
Upvotes: 6