Permalink
Browse files

Sort methods

  • Loading branch information...
1 parent 693d39f commit 303a8dc10b9c6df284f4f04ab36ed171a36b94d7 @justincampbell justincampbell committed Sep 23, 2012
Showing with 11 additions and 11 deletions.
  1. +1 −1 Guardfile
  2. +10 −10 lib/easystats.rb
View
@@ -1,4 +1,4 @@
-guard 'rspec', :version => 2, :rvm => %w[1.8.7 1.9.3].map { |v| v << "@easystats" } do
+guard 'rspec', :version => 2, :rvm => %w[1.9.3] do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
View
@@ -1,14 +1,4 @@
class Array
- def probability_distribution
- return if self.empty?
-
- total = self.count.to_f
-
- self.inject({}) { |result, item|
- result.update({ item => self.count(item) / total })
- }
- end unless method_defined? :probability_distribution
-
def mean
return if self.empty?
@@ -44,6 +34,16 @@ def mode
frequencies.last[0]
end unless method_defined? :mode
+ def probability_distribution
+ return if self.empty?
+
+ total = self.count.to_f
+
+ self.inject({}) { |result, item|
+ result.update({ item => self.count(item) / total })
+ }
+ end unless method_defined? :probability_distribution
+
def range
return if self.empty?

0 comments on commit 303a8dc

Please sign in to comment.