Sha256: 7a7944b18dd3ca20aef5f28dc01d8b09adb48ba5f9f74cc7fe1ccbf88de25908

Contents?: true

Size: 514 Bytes

Versions: 3

Compression:

Stored size: 514 Bytes

Contents

module Spielbash
  class MessageAction < Spielbash::BaseAction
    attr_accessor :message

    def initialize(message, action_context)
      super(action_context)
      @message = message
    end

    def execute(session)
      message.each_char do |c|
        session.send_key(c)
        sleep(action_context.typing_delay_s)
      end
      sleep(action_context.reading_delay_s)

      session.send_key('C-h', message.length) if (action_context.delete)
      sleep(action_context.typing_delay_s)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spielbash-0.1.4 lib/spielbash/model/action/message_action.rb
spielbash-0.1.3 lib/spielbash/model/action/message_action.rb
spielbash-0.1.2 lib/spielbash/model/action/message_action.rb