Launch module as a service

Hi, i have have a module like that the ruby file is bots.rb

intReq = Bots::Payments::new
intRed.launch

on my development PC, i have just to execute (on terminal)

1.(inside terminal)
ruby cors.rb
to launch module

2. (inside rails console)
a = Bots::Payments::new
a.launch

how can i launch this module when my web server start (rails s) as a background service to continuously listen some specials request?

this is my module file

module Bots
  class Payments
    def initialize
        @elemnt1 = "waiting rails 7"
        @element2 = "rbs is awesome"
    end

    def launch
      # logic
    end

  end
end

# launch command
puts "lauching service payment..."
a = Bots::Payments::new
a.messages

Thanks