Add Array#percentrank(value) and Range#percentrank(value).
Function description, See PERCENTRANK function - Excel - Office.com (in Japanese: PERCENTRANK 関数 - Excel - Office.com).
Add this line to your application's Gemfile:
gem 'percentrank'
And then execute:
$ bundle
Or install it yourself as:
$ gem install percentrank
require 'percentrank'
([125, 150, 160, 90]).percentrank(125) #=> 0.33.
([12 , 13, 14, 10]).percentrank(14) #=> 1 .
- 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