Skip to content

Instantly share code, notes, and snippets.

@rakibulislam
Last active November 6, 2020 14:47
Show Gist options
  • Save rakibulislam/2da79bb82641a9e43d8a48715d660fb0 to your computer and use it in GitHub Desktop.
Save rakibulislam/2da79bb82641a9e43d8a48715d660fb0 to your computer and use it in GitHub Desktop.
class MyWorker
    def perform(params={})
      puts "params: #{params.inspect}"
      params = params.to_h.transform_keys(&:to_sym)
      puts "params after transform: #{params.inspect}"
      execute(**params)
    end

    def execute(name: "there", age: 20)
      puts "Hi #{name}, your age is: #{age}!"
    end
end

MyWorker.perform_async(name: 'Rakib', age: 32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment