Flexyear
Flexible years! Parse decades, ranges, and etc into low & high values.
Examples:
FlexYear.new("1980s").year_low == 1980
FlexYear.new("1980s").year_high == 1989
FlexYear.new("mid-80s").year_low == 1983
FlexYear.new("mid-80s").year_high == 1986
FlexYear.new(1983).year_low == 1983
FlexYear.new(1983).year_high == 1983
FlexYear.new(["1980s", "1988 - 2000", 2001]).year_low == 1980
FlexYear.new(["1980s", "1988 - 2000", 2001]).year_high == 2001
It's pretty flexible in the kinds of things it takes. For more examples, see the spec.
Installation
Add this line to your application's Gemfile:
gem 'flexyear'
And then execute:
$ bundle
Or install it yourself as:
$ gem install flexyear
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
Test
rake