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.
preguntado el 31 de julio de 12 a las 10:07
Benjamin Tan Wei Hao
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.