I have singleton class named TransactionCreateTemplate and this class has a instance method with one parameter def mail_payload(json_params) my question is, if we create local variable inside the mail_payload method whether that local variable is thread safe?
class TransactionCreateTemplate
include Singleton
def mail_payload(json_params)
transaction = Transaction.new(params[:name])
end
end
class Transaction
def initialize(name)
@name = name
end
end
In the above one, whether transaction local variable inside the mail_payload method is thread safe?, since it is singleton class, only one object is created and that same object is used by different threads, i am confused.