Skip to content

Instantly share code, notes, and snippets.

@AviFS
Created April 11, 2025 23:07
Show Gist options
  • Save AviFS/7099222f26fa818e97ec4edc43ca2daf to your computer and use it in GitHub Desktop.
Save AviFS/7099222f26fa818e97ec4edc43ca2daf to your computer and use it in GitHub Desktop.
require 'roda'
class Mailer < Roda
plugin :mailer
route do |r|
r.mail 'current_welcome' do |user_id, mail_from|
<<~BODY
user_id: #{user_id.inspect}
mail_from: #{mail_from.inspect}
BODY
end
r.mail 'proposed_welcome', Integer do |user_id, mail_from|
<<~BODY
user_id: #{user_id.inspect}
mail_from: #{mail_from.inspect}
BODY
end
end
end
puts "current"
puts Mailer.mail('/current_welcome/2', '[email protected]').body
puts
puts "proposed"
puts Mailer.mail('/proposed_welcome/2', '[email protected]').body
@AviFS
Copy link
Author

AviFS commented Apr 11, 2025

Output:

current
user_id: "[email protected]"
mail_from: nil

proposed
user_id: 2
mail_from: "[email protected]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment