I have a log file that I’ve created using the simple command:
logFile = File.new("../LOGS/IF4IT.log", "w")
I can easily write to it at a global level using syntax like:
logFile.puts 'Write this string to logFile.'
I’d like to pass the log file into a Class I’ve defined so I can print
to the logFile from inside Class methods. I try to pass in the log file
like I would any other variable but I get error messages. Is there a
specific syntax that I should be using?
def initialize stringOne, stringTwo, logFile
The above class yields errors when I try to invoke it using:
newMyClass = MyClass.new stringA, stringB, logFile
I’ve tried to find documentation that talks about passing Files as
arguments to methods and to classes but can’t seem to find anything
obvious. Any thoughts?
Thanks for your help, in advance!