Class: Array
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#normalize ⇒ Object
75 76 77 78 |
# File 'lib/sbn/helpers.rb', line 75 def normalize sum = self.inject(0.0) {|sum, e| sum += e } self.map {|e| e.to_f / sum } end |
#normalize! ⇒ Object
80 81 82 83 |
# File 'lib/sbn/helpers.rb', line 80 def normalize! sum = self.inject(0.0) {|sum, e| sum += e } self.map! {|e| e.to_f / sum } end |
#symbolize_values ⇒ Object
67 68 69 |
# File 'lib/sbn/helpers.rb', line 67 def symbolize_values self.map {|e| e.to_underscore_sym } end |
#symbolize_values! ⇒ Object
71 72 73 |
# File 'lib/sbn/helpers.rb', line 71 def symbolize_values! self.map! {|e| e.to_underscore_sym } end |