GithubHelp home page GithubHelp logo

yusupova / zodiac Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 7even/zodiac

0.0 1.0 0.0 432 KB

A small gem for calculating zodiac sign from a date of birth

Home Page: 7even.github.com/zodiac

Ruby 92.38% HTML 7.62%

zodiac's Introduction

zodiac Build Status Gem Version Gitter

This is a fork of http://github.com/7even/zodiac.

What's different:

  • no active record methods
  • different date spans

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 and can also extend ActiveRecord::Base with several instance (delegated to some date attribute of the model object) and class methods (allowing you to search for objects with a certain zodiac sign)

Installation

gem install zodiac

Or, if you want to extend your rails app, add the following to the Gemfile:

gem 'zodiac'

and run bundle install.

Usage

Time/Date/DateTime usage

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.

There are also predicate methods which return true if the date is matching the specified zodiac sign (and false otherwise).

Date.new(1989, 2, 26).pisces? # => true
Time.gm(1978, 7, 12).gemini?  # => false

zodiac's People

Contributors

7even avatar yusupova avatar dylan0203 avatar jazminschroeder avatar jeffrydegrande avatar hamakn avatar belibaste avatar gitter-badger avatar travisp avatar donbobka avatar lucapette avatar krim avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.