ruby-nuggets 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to ruby-nuggets version 0.6.0
5
+ This documentation refers to ruby-nuggets version 0.6.1
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -0,0 +1,5 @@
1
+ require 'nuggets/range/quantile_mixin'
2
+
3
+ class Range
4
+ include Nuggets::Range::QuantileMixin
5
+ end
@@ -0,0 +1,43 @@
1
+ #--
2
+ ###############################################################################
3
+ # #
4
+ # A component of ruby-nuggets, some extensions to the Ruby programming #
5
+ # language. #
6
+ # #
7
+ # Copyright (C) 2007-2009 Jens Wille #
8
+ # #
9
+ # Authors: #
10
+ # Jens Wille <jens.wille@uni-koeln.de> #
11
+ # #
12
+ # ruby-nuggets is free software; you can redistribute it and/or modify it #
13
+ # under the terms of the GNU General Public License as published by the Free #
14
+ # Software Foundation; either version 3 of the License, or (at your option) #
15
+ # any later version. #
16
+ # #
17
+ # ruby-nuggets is distributed in the hope that it will be useful, but WITHOUT #
18
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
19
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
20
+ # more details. #
21
+ # #
22
+ # You should have received a copy of the GNU General Public License along #
23
+ # with ruby-nuggets. If not, see <http://www.gnu.org/licenses/>. #
24
+ # #
25
+ ###############################################################################
26
+ #++
27
+
28
+ module Nuggets
29
+ class Range
30
+ module QuantileMixin
31
+
32
+ # call-seq:
33
+ # range.quantile(value, order = 100) => anInteger
34
+ #
35
+ # Determines the <tt>order</tt>-quantile of +value+ in _range_.
36
+ def quantile(value, order = 100)
37
+ value < first ? 1 : value >= last ? order :
38
+ ((value - first) / ((last - first) / order.to_f)).to_i + 1
39
+ end
40
+
41
+ end
42
+ end
43
+ end
@@ -4,7 +4,7 @@ module Nuggets
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 6
7
- TINY = 0
7
+ TINY = 1
8
8
 
9
9
  class << self
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-nuggets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
@@ -99,6 +99,8 @@ files:
99
99
  - lib/nuggets/object/boolean.rb
100
100
  - lib/nuggets/proc/bind_mixin.rb
101
101
  - lib/nuggets/proc/bind.rb
102
+ - lib/nuggets/range/quantile_mixin.rb
103
+ - lib/nuggets/range/quantile.rb
102
104
  - lib/nuggets/util/added_methods.rb
103
105
  - lib/nuggets/util/content_type.rb
104
106
  - lib/nuggets/util/dotted_decimal.rb