Assume x is a gem, that contains both Hello and Goodbye classes.
If I write a program that require 'x', but only uses the Hello class. Is the Goodbye class loaded as well?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You include scripts or files, not gems.
With
you load the file
x.rb. Whichx.rbyou load is defined by the search path, the search pathes can be modified by gem definitions (what you didn’t use in your example code).Everything inside the file
x.rbis loaded. Ifx.rbcontains otherrequirecommands, those files are also loaded.