Sha256: 866d2fd18ff875e6b53cd6b2073e9de292ad826b8fa1c345e34a77904cdc8191

Contents?: true

Size: 425 Bytes

Versions: 1

Compression:

Stored size: 425 Bytes

Contents

require_relative '../command_handler'
require_relative 'models/r_color'

class ColorCommandHandler
  include CommandHandler

  def can_handle?(parent, command_symbol, *args, &block)
    parent.is_a?(RWidget) and
      ['rgba', 'rgb'].include?(command_symbol.to_s) and
      (3..4).include?(args.count)
  end

  def do_handle(parent, command_symbol, *args, &block)
    RColor.new(parent.widget.display, *args).color
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glimmer-0.3.3 lib/command_handlers/color_command_handler.rb