Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created July 28, 2020 21:52
Show Gist options
  • Save havenwood/2da302c63b6359e2b359f475219f46c0 to your computer and use it in GitHub Desktop.
Save havenwood/2da302c63b6359e2b359f475219f46c0 to your computer and use it in GitHub Desktop.
module Worker
ROLES = %w[admin manager].freeze
def perform
@role = ROLES.sample
select_based_on_role
end
def select_based_on_role
puts case @role
when "admin"
"i'm an admin"
when "manager"
"i'm a manager"
end
end
end
class BreadWorker
include Worker
end
class CakeWorker
include Worker
end
BreadWorker.new.perform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment