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