lib/ray_tracer/tuple.rb
def scale(clamp_max)
      self.class[
        *[red, green, blue]
           .map { |rgb| rgb * clamp_max }
           .map { |rgb| rgb.clamp(0, clamp_max) }
           .map { |rgb| rgb.round(0, half: :even) }
      ]
    end
# Scale the color values to a maximum value
Scale the color values to a maximum value
Scale the color values to a maximum value
def scale(clamp_max)
      self.class[
        *[red, green, blue]
           .map { |rgb| rgb * clamp_max }
           .map { |rgb| rgb.clamp(0, clamp_max) }
           .map { |rgb| rgb.round(0, half: :even) }
      ]
    end
def scale ( clamp_max ) self . class [ * [ red , green , blue ] . map { | rgb | rgb * clamp_max } . map { | rgb | rgb . clamp ( 0 , clamp_max ) } . map { | rgb | rgb . round ( 0 , half : :even ) } ] end
Scale the color values to a maximum value
Scale the color values to a maximum value
clamp_max