Module: Rya::CoreExtensions::Array
- Defined in:
- lib/rya/core_extensions.rb
Instance Method Summary collapse
-
#scale(new_min, new_max) ⇒ Object
Scales with respect to the min and max of the data actually in the Array.
-
#scale_fixed(old_min, old_max, new_min, new_max) ⇒ Object
Scales with respect to a fixed old_min and old_max.
Instance Method Details
#scale(new_min, new_max) ⇒ Object
Scales with respect to the min and max of the data actually in the Array.
7 8 9 10 11 12 |
# File 'lib/rya/core_extensions.rb', line 7 def scale new_min, new_max old_min = self.min old_max = self.max self.scale_fixed old_min, old_max, new_min, new_max end |
#scale_fixed(old_min, old_max, new_min, new_max) ⇒ Object
Scales with respect to a fixed old_min and old_max
15 16 17 18 19 |
# File 'lib/rya/core_extensions.rb', line 15 def scale_fixed old_min, old_max, new_min, new_max self.map do |elem| Rya::ExtendedClasses::MATH.scale elem, old_min, old_max, new_min, new_max end end |