> A capitalized variable like `CONFIG` makes a...
# voxpupuli
m
A capitalized variable like
CONFIG
makes a constant which gets "enclosing scope" which is kind of like global to the class or module it's declared in.
you explanation helped. ❤️ This feature is exceeding my expectations:
Copy code
#scope.rb
module Scope
  CONFIG = { 'module' => 'default' }
  def dbg
    CONFIG.each do |k, v| puts "#{k}=#{v.inspect}"; end
  end
end

include Scope
Copy code
#use_scope.rb
require_relative 'scope'
CONFIG['foo']='bar'
dbg
Copy code
$ ruby use_scope.rb
module="default"
foo="bar"