I’m studying Spree’s source code and I came across the snippet.
Spree.config do |config|
# Example:
# Uncomment to override the default site name.
# config.site_name = "Spree Demo Site"
end
How is this being implemented? I cannot find Spree.config defined anywhere as a method. I’m guessing some meta-programming is involved.
Looks like it is defined in https://github.com/spree/spree/blob/master/core/lib/spree/core.rb (line 68 at this time).
configis a module method on theSpreemodule. It’s implementation passes theSpree::Configobject to the given block.