Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/zipf/misc.rb
Instance Method Summary collapse
Instance Method Details
#is_subset_of?(other) ⇒ Boolean
9 10 11 12 13 14 15 16 |
# File 'lib/zipf/misc.rb', line 9 def is_subset_of? other self.each { |i| if other.include? i return false end } return true end |
#max_index ⇒ Object
5 6 7 |
# File 'lib/zipf/misc.rb', line 5 def max_index self.index(self.max) end |
#mean ⇒ Object
22 23 24 |
# File 'lib/zipf/misc.rb', line 22 def mean self.sum.to_f/self.size end |
#sum ⇒ Object
18 19 20 |
# File 'lib/zipf/misc.rb', line 18 def sum self.inject(:+) end |