Created
October 25, 2010 03:50
-
-
Save nikz/644352 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def temporal_greeting(user, time_zone = ActiveSupport::TimeZone["Wellington"]) | |
| hour = Time.now.in_time_zone(time_zone).hour | |
| case hour | |
| when 6..12 | |
| "Good morning #{user.first_name}!" | |
| when 12..17 | |
| "Afternoon, #{user.first_name}." | |
| when 17..12 | |
| "Evening #{user.first_name}." | |
| when 0..6 | |
| "Gosh #{user.first_name}, you're up late!" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment