Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

test

  • Loading branch information...
commit 40dfb4190f3c0c0aea2cb50c1306674cd6198587 1 parent dbf501c
@7even authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  params.json
View
2  params.json
@@ -1 +1 @@
-{"name":"Zodiac","body":"# zodiac\r\n\r\n`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)\r\n\r\n## Installation\r\n\r\n``` bash\r\ngem install zodiac\r\n```\r\n\r\nOr, if you want to extend your rails app, add the following to the `Gemfile`:\r\n\r\n``` ruby\r\ngem 'zodiac'\r\n```\r\n\r\nand run `bundle install`.\r\n\r\n## Usage\r\n\r\n### Time/Date/DateTime usage\r\n\r\n``` ruby\r\nrequire 'zodiac'\r\nTime.now.zodiac_sign # => \"Aries\"\r\nrequire 'date'\r\nDate.new(2011, 1, 1).zodiac_sign # => \"Capricorn\"\r\nDateTime.new(2011, 4, 30).zodiac_sign # => \"Taurus\"\r\n```\r\n\r\n`#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](http://github.com/7even/zodiac/blob/master/lib/locales/en.yml).\r\n\r\nThere are also predicate methods which return `true` if the date is matching the specified zodiac sign (and `false` otherwise).\r\n\r\n``` ruby\r\nDate.new(1989, 2, 26).pisces? # => true\r\nTime.gm(1978, 7, 12).gemini? # => false\r\n```\r\n\r\n### ActiveRecord usage\r\n\r\nThe first thing you need to do is to add `gem 'zodiac'` to your `Gemfile` as described before.\r\n\r\nTo add zodiac methods to your model you just call a `zodiac_reader` macro in your model passing it the name of the attribute containing the date of birth:\r\n\r\n``` ruby\r\nclass Person < ActiveRecord::Base\r\n zodiac_reader :dob\r\nend\r\n```\r\n\r\nand then you'll be able to get zodiac sign of your object just by calling `#zodiac_sign` on it:\r\n\r\n``` ruby\r\n@person = Person.first\r\n@person.zodiac_sign # => \"Taurus\"\r\n```\r\n\r\nYou can also use the predicate methods like `#libra?`\r\n\r\n``` ruby\r\n@person.libra? # => false\r\n@person.taurus? # => true\r\n```\r\n\r\nIf you also need to search for all geminis in your `people` table, you should add an integer field containing a numerical id of the person's zodiac sign to that table. `zodiac` can help you with that - it already includes a generator `zodiac:migration` which creates a migration adding that field to your table (and an index on that field). You should specify the name of your model class as the first argument while calling the generator:\r\n\r\n``` bash\r\nrails generate zodiac:migration Person\r\n```\r\n\r\n(Note that you must call `zodiac_reader` in your model in order for the migration to run correctly - after creating a new field the migration tries to update it for all existing records)\r\n\r\nNow `zodiac_reader` macro in your model gives you some scopes to filter objects by a zodiac sign:\r\n\r\n``` ruby\r\nPerson.with_zodiac_sign('libra') # returns all libras\r\nPerson.gemini # all the geminis\r\n```\r\n\r\nTo keep the consistency of a zodiac sign with the date of birth, `zodiac_reader` also installs a `before_save` filter to your model, which updates the sign field every time you change the date-of-birth attribute.\r\n\r\nIf you don't like the name of the field containing zodiac sign (by default it's `zodiac_sign_id`), you can customize it, passing the wanted name as an option to `zodiac_reader` in your model and then as the second parameter to the generator:\r\n\r\n``` ruby\r\nclass Person < ActiveRecord::Base\r\n zodiac_reader :dob, :sign_id_attribute => :custom_sign_id\r\nend\r\n```\r\n\r\n``` bash\r\nrails generate zodiac:migration Person custom_sign_id\r\n```\r\n\r\n## Included locales\r\n\r\n* en (English)\r\n* ru (Russian)\r\n* pt-BR (Brazilian Portuguese) - thanks [jeffrydegrande](https://github.com/jeffrydegrande)\r\n* ja (Japanese) - thanks [hamakn](https://github.com/hamakn)\r\n* it (Italian) - thanks [lucapette](https://github.com/lucapette)\r\n* es (Spanish) - thanks [jazminschroeder](https://github.com/jazminschroeder)\r\n\r\n## Changelog\r\n\r\n* 0.1 Initial version with Time/Date/DateTime extension and [:ru, :en] locales\r\n* 0.1.1 Added Brazilian Portuguese locale (thanks [jeffrydegrande](https://github.com/jeffrydegrande))\r\n* 0.2 Added ActiveRecord support (scopes, predicate methods and delegating `#zodiac_sign` to date-of-birth attribute)\r\n* 0.2.1 Added Japanese locale (thanks [hamakn](https://github.com/hamakn))\r\n* 0.2.2 Added Italian locale (thanks [lucapette](https://github.com/lucapette))\r\n* 0.2.3 Added Spanish locale (thanks [jazminschroeder](https://github.com/jazminschroeder))\r\n* 0.2.4 Correct leap-year dates handling (thanks [BastienDuplessier](https://github.com/BastienDuplessier))\r\n\r\n## Roadmap\r\n\r\n1. Rdoc/YARD coverage of everything\r\n\r\n2. Other ORMs support (DataMapper, Sequel, Mongoid)\r\n\r\n3. ActiveRecord 4.0 support (extending AR::Model instead of AR::Base)\r\n\r\n## Contributing\r\n\r\nFork the repository, push your changes to a topic branch and send me a pull request.\r\n","tagline":"A small gem for calculating zodiac sign from a date of birth","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
+{"name":"Zodiac","body":"# zodiac\r\n\r\n`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)\r\n\r\n## Installation\r\n\r\n``` bash\r\ngem install zodiac\r\n```\r\n\r\nOr, if you want to extend your rails app, add the following to the `Gemfile`:\r\n\r\n``` ruby\r\ngem 'zodiac'\r\n```\r\n\r\nand run `bundle install`.\r\n\r\n## Usage\r\n\r\n### Time/Date/DateTime usage\r\n\r\n``` ruby\r\nrequire 'zodiac'\r\nTime.now.zodiac_sign # => \"Aries\"\r\nrequire 'date'\r\nDate.new(2011, 1, 1).zodiac_sign # => \"Capricorn\"\r\nDateTime.new(2011, 4, 30).zodiac_sign # => \"Taurus\"\r\n```\r\n\r\n`#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](http://github.com/7even/zodiac/blob/master/lib/locales/en.yml).\r\n\r\nThere are also predicate methods which return `true` if the date is matching the specified zodiac sign (and `false` otherwise).\r\n\r\n``` ruby\r\nDate.new(1989, 2, 26).pisces? # => true\r\nTime.gm(1978, 7, 12).gemini? # => false\r\n```\r\n\r\n### ActiveRecord usage\r\n\r\nThe first thing you need to do is to add `gem 'zodiac'` to your `Gemfile` as described before.\r\n\r\nTo add zodiac methods to your model you just call a `zodiac_reader` macro in your model passing it the name of the attribute containing the date of birth:\r\n\r\n``` ruby\r\nclass Person < ActiveRecord::Base\r\n zodiac_reader :dob\r\nend\r\n```\r\n\r\nand then you'll be able to get zodiac sign of your object just by calling `#zodiac_sign` on it:\r\n\r\n``` ruby\r\n@person = Person.first\r\n@person.zodiac_sign # => \"Taurus\"\r\n```\r\n\r\nYou can also use the predicate methods like `#libra?`\r\n\r\n``` ruby\r\n@person.libra? # => false\r\n@person.taurus? # => true\r\n```\r\n\r\nIf you also need to search for all geminis in your `people` table, you should add an integer field containing a numerical id of the person's zodiac sign to that table. `zodiac` can help you with that - it already includes a generator `zodiac:migration` which creates a migration adding that field to your table (and an index on that field). You should specify the name of your model class as the first argument while calling the generator:\r\n\r\n``` bash\r\nrails generate zodiac:migration Person\r\n```\r\n\r\n(Note that you must call `zodiac_reader` in your model in order for the migration to run correctly - after creating a new field the migration tries to update it for all existing records)\r\n\r\nNow `zodiac_reader` macro in your model gives you some scopes to filter objects by a zodiac sign:\r\n\r\n``` ruby\r\nPerson.with_zodiac_sign('libra') # returns all libras\r\nPerson.gemini # all the geminis\r\n```\r\n\r\nTo keep the consistency of a zodiac sign with the date of birth, `zodiac_reader` also installs a `before_save` filter to your model, which updates the sign field every time you change the date-of-birth attribute.\r\n\r\nIf you don't like the name of the field containing zodiac sign (by default it's `zodiac_sign_id`), you can customize it, passing the wanted name as an option to `zodiac_reader` in your model and then as the second parameter to the generator:\r\n\r\n``` ruby\r\nclass Person < ActiveRecord::Base\r\n zodiac_reader :dob, :sign_id_attribute => :custom_sign_id\r\nend\r\n```\r\n\r\n``` bash\r\nrails generate zodiac:migration Person custom_sign_id\r\n```\r\n\r\n## Included locales\r\n\r\n* en (English)\r\n* ru (Russian)\r\n* pt-BR (Brazilian Portuguese) - thanks [jeffrydegrande](https://github.com/jeffrydegrande)\r\n* ja (Japanese) - thanks [hamakn](https://github.com/hamakn)\r\n* it (Italian) - thanks [lucapette](https://github.com/lucapette)\r\n* es (Spanish) - thanks [jazminschroeder](https://github.com/jazminschroeder)\r\n\r\n## Changelog\r\n\r\n* 0.1 Initial version with Time/Date/DateTime extension and [:ru, :en] locales\r\n* 0.1.1 Added Brazilian Portuguese locale (thanks [jeffrydegrande](https://github.com/jeffrydegrande))\r\n* 0.2 Added ActiveRecord support (scopes, predicate methods and delegating `#zodiac_sign` to date-of-birth attribute)\r\n* 0.2.1 Added Japanese locale (thanks [hamakn](https://github.com/hamakn))\r\n* 0.2.2 Added Italian locale (thanks [lucapette](https://github.com/lucapette))\r\n* 0.2.3 Added Spanish locale (thanks [jazminschroeder](https://github.com/jazminschroeder))\r\n* 0.2.4 Correct leap-year dates handling (thanks [BastienDuplessier](https://github.com/BastienDuplessier))\r\n\r\n## Roadmap\r\n\r\n1. Rdoc/YARD coverage of everything\r\n\r\n2. Other ORMs support (DataMapper, Sequel, Mongoid)\r\n\r\n3. ActiveRecord 4.0 support (extending AR::Model instead of AR::Base)\r\n\r\n## Contributing\r\n\r\nFork the repository, push your changes to a topic branch and send me a pull request.\r\n","tagline":"A big gem for calculating zodiac sign from a date of birth","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
Please sign in to comment.
Something went wrong with that request. Please try again.