View on GitHub


Zodiac sign calculator

download .ZIPdownload .TGZ


zodiac is a ruby library for finding one’s zodiac sign by a date of birth.


$ gem install zodiac


# Gemfile
gem 'zodiac'


Time/Date/DateTime usage

require 'zodiac'                  # => "Aries"
require 'date', 1, 1).zodiac_sign      # => "Capricorn", 4, 30).zodiac_sign # => "Taurus"

Zodiac sign names are retrieved from I18n and can be added to standard locales if your language isn’t yet supported by the gem., 2, 26).pisces? # => true, 7, 12).gemini?  # => false

ActiveRecord usage

Suppose you have a date of birth in dob column.

# app/models/person.rb
class Person < ActiveRecord::Base
  zodiac_reader :dob

Now your Person instances have the same zodiac functionality as Time and Date:

@person = Person.first
@person.zodiac_sign    # => "Taurus"
@person.libra?         # => false
@person.taurus?        # => true

ActiveRecord searching by zodiac sign

$ rails generate zodiac:migration Person
$ rake db:migrate
Person.with_zodiac_sign('libra') # returns all libras
Person.gemini                    # all the geminis

Included locales