Sha256: c90fef6b6f1c19e39a650fe80b031824348d59272b3aec082925d6bfeb9db651

Contents?: true

Size: 513 Bytes

Versions: 3

Compression:

Stored size: 513 Bytes

Contents

class Shoes
  class Gradient
    include Common::Inspect
    include Comparable

    def initialize(color1, color2, alpha = Shoes::Color::OPAQUE)
      @color1, @color2 = color1, color2
      @alpha = alpha
    end

    attr_reader :alpha, :color1, :color2

    def <=>(other) # arbitrarily compare 1st non-equal color
      return unless other.is_a?(self.class)
      [color1, color2] <=> [other.color1, other.color2]
    end

    private

    def inspect_details
      " #{color1}->#{color2}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shoes-core-4.0.0.pre6 lib/shoes/gradient.rb
shoes-core-4.0.0.pre5 lib/shoes/gradient.rb
shoes-core-4.0.0.pre4 lib/shoes/gradient.rb