Answer the question
In order to leave comments, you need to log in
Is it possible to require files inside methods like this?
def opop
require './SomeClass.rb'
end
opop
Answer the question
In order to leave comments, you need to log in
Nothing prevents you from doing this, but it is not very good in terms of code organization.
Also, you don't need to specify the .rb file extension, require will do it for you.
A file with a relative path is better to load like this:require File.expand_path('../someclass', __FILE__)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question