ARTICLE AD BOX
My question could apply to many other ruby frameworks I guess. But here I have the case while programming a Jekyll project.
Let's see this Jekyll plugin as an example:
require 'dotenv' module Jekyll class EnvironmentVariablesGenerator < Generator priority :highest def generate(site) site.config['env'] = Dotenv.load Jekyll.logger.debug "#{__FILE__} Loading env variables: " Jekyll.logger.debug site.config.to_yaml end end endWhy is Jekyll.logger magically available? I've read the "Programming Ruby" book, and while it explains how require works when writing your own standalone program, it doesn't explain how a framework such as Jekyll makes things available in the scope of some ruby files. I find it quite confusing, being more used to ES6 that always as explicit imports.
