Sha256: 19ae8fe5dca290abeb87ebcd80543186e5729e8a3dc67cf3f2e5f60873c91042

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 Bytes

Contents

# frozen_string_literal: true

require_relative 'base'

module Wizrb
  module Shared
    module Events
      class PowerEvent < Wizrb::Shared::Events::Base
        def initialize(value)
          validate!(value)
          super(method: 'setPilot', params: { state: value })
        end

        private

        def validate!(value)
          raise ArgumentError, 'Power state must be a boolean' unless [true, false].include?(value)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wizrb-1.1.2 lib/wizrb/shared/events/power_event.rb