Suppose you have
[started, stopped].each do |action|
# puts "#{action} is :started" # or
# puts "#{action} is :stopped"
end
Getting the original variable name of the current item (action) I followed this answer https://stackoverflow.com/a/14074652/3577482, but it requires additional helper methods
Aucun commentaire:
Enregistrer un commentaire