Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ZodiacHelper
- def zodiac_sign_for(date)
- if date.respond_to?(:strftime)
- birth = date.strftime("%m%d").to_i # month/day as an integer
- else
- birth = date
- end
- case birth
- when 11..120 then zodiac = "Capricorn"
- when 121..219 then zodiac = "Aquarius"
- when 220..320 then zodiac = "Pisces"
- when 321..420 then zodiac = "Aries"
- when 421..521 then zodiac = "Taurus"
- when 522..621 then zodiac = "Gemini"
- when 622..722 then zodiac = "Cancer"
- when 723..821 then zodiac = "Leo"
- when 822..923 then zodiac = "Virgo"
- when 924..1023 then zodiac = "Libra"
- when 1024..1122 then zodiac = "Scorpio"
- when 1123..1222 then zodiac = "Sagittarius"
- when 1223..1231 then zodiac = "Capricorn"
- else
- raise "Invalid date for zodiac sign - #{date}"
- end
- zodiac
- end
- end
Add Comment
Please, Sign In to add comment