Skip to content

Instantly share code, notes, and snippets.

@ffaerber
Created August 27, 2013 14:45
Show Gist options
  • Select an option

  • Save ffaerber/6354484 to your computer and use it in GitHub Desktop.

Select an option

Save ffaerber/6354484 to your computer and use it in GitHub Desktop.
Prioritize things
positions = %w(
reset_password_mail
registration_mail
welcome_mail
newsletter
)
class Prioritize
def initialize(positions)
positions.each do |position|
self.class.class_exec do
define_method(position) {positions.index(position)}
end
end
end
end
prioritize = Prioritize.new(positions)
prioritize.welcome_mail => 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment