Ageism
Quickly parse age intervals.
This gem was born of a need to allow teachers search for children by age, using an ultra-simple syntax and without complicated and messy drop-down boxes. Given that teachers and admins are thinking in terms of age rather than date of birth, it's important to provide a widget that speaks their language, so the system overall is more fluid and intuitive to use.
Installation
Add this line to your application's Gemfile:
gem 'ageism'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ageism
Usage
module ApplicationHelper # or wherever you plan to use this
include Ageism
...
min, max = parse_age_range params[:age_range]
Examples
parse_age_range "12 - 13" # => [144, 156]
parse_age_range "0 6 - 1 6" # => [6, 18]
parse_age_range "0y 6m - 1y 6m" # => [6, 18]
parse_age_range "0 ans 6 mois - 1 an 6 mois" # => [6, 18]
parse_age_range "2 jahr - 3jahr" # => [24, 36]
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request