Reputation: 9701
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.
Upvotes: 2
Views: 1090
Reputation: 15736
Looks like it is defined in https://github.com/spree/spree/blob/master/core/lib/spree/core.rb (line 68 at this time).
config
is a module method on the Spree
module. It's implementation passes the Spree::Config
object to the given block.
Upvotes: 3