Ruby on rails - Static method

后端 未结 6 497
青春惊慌失措
青春惊慌失措 2020-12-09 07:31

I want a method to be executed every 5 minutes, I implemented whenever for ruby (cron). But it does not work. I think my method is not accessible. The method I want to exec

6条回答
  •  北海茫月
    2020-12-09 07:42

    To declare a static method, write ...

    def self.checkPings
      # A static method
    end
    

    ... or ...

    class Myclass extend self
    
      def checkPings
        # Its static method
      end
    
    end
    

提交回复
热议问题