Sha256: 4b736e78d82f9ea2329872beb5d44750d9466cf09f3c07ef1d48eede03e7c7c0

Contents?: true

Size: 648 Bytes

Versions: 6

Compression:

Stored size: 648 Bytes

Contents

module Api
  # Adds additional functionality and fixes quirks with color specifically pertaining to debug commands
  module ColorExtension
    # For lines: r & b are swapped.
    def initialize(r:, g:, b:)
      super(r: b, g: g, b: r)
    end

    # Adds additional functionality to message class Api::Color
    module ClassMethods
      # Creates a new Api::Color object with random rgb values
      # @return [Api::Color] random color
      def random
        Api::Color.new(r: rand(0..255), g: rand(0..255), b: rand(0..255))
      end
    end
  end
end
Api::Color.include Api::ColorExtension
Api::Color.extend Api::ColorExtension::ClassMethods

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sc2ai-0.0.8 lib/sc2ai/protocol/extensions/color.rb
sc2ai-0.0.7 lib/sc2ai/protocol/extensions/color.rb
sc2ai-0.0.5 lib/sc2ai/protocol/extensions/color.rb
sc2ai-0.0.4 lib/sc2ai/protocol/extensions/color.rb
sc2ai-0.0.3 lib/sc2ai/protocol/extensions/color.rb
sc2ai-0.0.2 lib/sc2ai/protocol/extensions/color.rb