zodiac
is a simple gem for getting a zodiac sign from a given date of birth. It extends Time
, Date
and DateTime
objects with a zodiac_sign
method.
gem install zodiac
require 'zodiac' Time.now.zodiac_sign # => "Aries" require 'date' Date.new(2011, 1, 1).zodiac_sign # => "Capricorn" DateTime.new(2011, 4, 30).zodiac_sign # => "Taurus"
#zodiac_sign
returns values using I18n with “zodiac.#{sign}” path, so if you want your own translations, you can put them in your locale with keys like zodiac.aries
, zodiac.taurus
etc. See examples here
en
ru
pt-BR (thanks jeffrydegrande)
- 0.1 Initial version with Time/Date/DateTime extension and [:ru, :en] locales
- 0.1.1 Added pt-BR locale (thanks jeffrydegrande)
1. Rdoc coverage of everything
2. ActiveRecord macro:
class Person < ActiveRecord::Base zodiac_reader :dob # dob is a DateTime attribute containing person's date of birth end Person.first.zodiac_sign # => "scorpio" Person.find_by_zodiac_sign("gemini") # => AR::Relation
Fork the repository, push your changes to a topic branch and send me a pull request.