When the class is loaded, all the lines are evaluated by ruby once:
The following two lines define two constants since they begin with a capital letter. This means there is only one THING and one AN_ARRAY.
AN_ARRAY = [ 1, 2 ]
THING = Classname.new.thing()
The def
statements below are also evaluated once and end up defining two class methods:
def self.perform(param)
# do stuff using THING, i.e. THING.do(something)
do_things(param)
end
def self.do_things(param)
# do stuff with AN_ARRAY and/or THING
end
So, the methods should work as expected in your queue workers.