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("1980s").decade == 1980s
FlexYear.new("mid-80s").year_low == 1983
FlexYear.new("mid-80s").year_high == 1986
FlexYear.new("mid-80s").decade == 1980s
FlexYear.new(1983).year_low == 1983
FlexYear.new(1983).year_high == 1983
FlexYear.new(1983).decade == 1980s
FlexYear.new(198*).year_low == 1980
FlexYear.new(198*).year_high == 1989
FlexYear.new(198*).decade == 1980s
FlexYear.new(["1980s", "1988 - 2000", 2001]).year_low == 1980
FlexYear.new(["1980s", "1988 - 2000", 2001]).year_high == 2001
FlexYear.new(["1980s", "1988 - 2000", nil, 2001]).decades == [1980s, nil, nil, 2000s]
It's pretty flexible in the kinds of things it takes. For more examples, see the spec.
Add this line to your application's Gemfile:
gem 'flexyear'
And then execute:
$ bundle
Or install it yourself as:
$ gem install flexyear
- 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
rake
We use bundlers rake commands to release versions. To cut and release a new version:
- Update lib/flexyear/version.rb and increment to your new desired version
- Commit and push your version bump
- Run
bundle exec rake release
to package and publish that version