S
sa 125
Hi - I'm new to ruby and trying to write some classes to help me with my
work. What I'm trying to figure out is how to access the class methods
from other files. Say that my class is
Class Example
$glob_1
def method_1
#...
end
def method_2
#...
end
end
Then in another file (same dir) I'd do:
require 'example'
f = example.method_1
Is this correct?
Also, I want to test my class - where do I add the:
if __FILE__ = $0
method_1
method_2
end
Thanks!
work. What I'm trying to figure out is how to access the class methods
from other files. Say that my class is
Class Example
$glob_1
def method_1
#...
end
def method_2
#...
end
end
Then in another file (same dir) I'd do:
require 'example'
f = example.method_1
Is this correct?
Also, I want to test my class - where do I add the:
if __FILE__ = $0
method_1
method_2
end
Thanks!