Module: Sass::Extras::Contrast::Utils

Defined in:
lib/sass/extras/contrast.rb

Class Method Summary collapse

Class Method Details

.abs(array, other) ⇒ Object



114
115
116
# File 'lib/sass/extras/contrast.rb', line 114

def self.abs(array, other)
  array.zip(other).map { |x, y| (x.to_f - y.to_f).abs }
end

.mul(array, other) ⇒ Object



118
119
120
# File 'lib/sass/extras/contrast.rb', line 118

def self.mul(array, other)
  array.zip(other).map { |x, y| x.to_f * y.to_f }
end

.sq(array) ⇒ Object



126
127
128
# File 'lib/sass/extras/contrast.rb', line 126

def self.sq(array)
  array.map { |e| e**2 }
end

.sum(array) ⇒ Object



122
123
124
# File 'lib/sass/extras/contrast.rb', line 122

def self.sum(array)
  array.inject(0) { |sum, value| sum + value.to_f }
end