class Rainbow::Opacity

Attributes

location[R]
value[R]

Public Class Methods

new(value, location) click to toggle source

value - Fixnum (0-100) location - Fixnum (0-100)

# File lib/rainbow/opacity.rb, line 8
def initialize(value, location)
  @value_percentage = value
  @value            = (255.0 * value / 100).round
  @location         = location

  assert_arguments!
end

Private Instance Methods

assert_arguments!() click to toggle source
# File lib/rainbow/opacity.rb, line 18
def assert_arguments!
  raise ArgumentError, 'opacity must be between 0 and 100' if @value_percentage < 0 || @value_percentage > 100
  raise ArgumentError, 'location must be between 0 and 100' if location < 0 || location > 100
end