Permalink
Browse files

Add Core#key_rate= to simplify dynamic key rate changes

If, for instance, you need to make typing very slow for a
particular test, you can change the key rate before and
restore the original value later.
  • Loading branch information...
ferrous26 committed May 17, 2012
1 parent a2bfc89 commit 64dd67c9608edabb3e360f416d85a5955d9dbd68
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/accessibility/core.rb
View
@@ -429,7 +429,7 @@ def post events
end
##
- # The delay between key presses. The default value is `0.01`, which
+ # The delay between key events. The default value is `0.01`, which
# should be about 50 characters per second (down and up are separate
# events).
#
@@ -448,6 +448,15 @@ def key_rate
else ENV['KEY_RATE'].to_f
end
+ ##
+ # Set the delay between key events. This value is used by {#post}
+ # to slow down the typing speed so apps do not get overloaded.
+ #
+ # @param [Number]
+ def key_rate= value
+ @@key_rate = value
+ end
+
# @!group Element Hierarchy Entry Points

0 comments on commit 64dd67c

Please sign in to comment.