lib/volt/tasks/dispatcher.rb
def safe_method?(klass, method_name)
      # Make sure the class being called is a TaskHandler.
      return false unless klass.ancestors.include?(TaskHandler)

      # Make sure the method is defined on the klass we're using and not up the hiearchy.
      #   ^ This check prevents methods like #send, #eval, #instance_eval, #class_eval, etc...
      klass.ancestors.each do |ancestor_klass|
        if ancestor_klass.instance_methods(false).include?(method_name)
          return true
        elsif ancestor_klass == TaskHandler
          # We made it to TaskHandler and didn't find the method, that means it
          # was defined above TaskHandler, so we reject the call.
          return false
        end
      end

      return false
    end
# Check if it is safe to use this method
Check if it is safe to use this method
Check if it is safe to use this method
def safe_method?(klass, method_name)
      return false unless klass.ancestors.include?(TaskHandler)
      klass.ancestors.each do |ancestor_klass|
        if ancestor_klass.instance_methods(false).include?(method_name)
          return true
        elsif ancestor_klass == TaskHandler
          return false
        end
      end
      return false
    end
def safe_method? ( klass , method_name ) return false unless klass . ancestors . include? ( TaskHandler ) klass . ancestors . each do | ancestor_klass | if ancestor_klass . instance_methods ( false ) . include? ( method_name ) return true elsif ancestor_klass == TaskHandler return false end end return false end
Check if it is safe to use this method
Check if it is safe to use this method
# Make sure the class being called is a TaskHandler. # Make sure the method is defined on the klass we're using and not up the hiearchy. #   ^ This check prevents methods like #send, #eval, #instance_eval, #class_eval, etc... # We made it to TaskHandler and didn't find the method, that means it # was defined above TaskHandler, so we reject the call.
klass
method_name