Module: Accessibility::Keyboard

Defined in:
lib/accessibility/keyboard.rb,
lib/accessibility/keyboard/version.rb,
ext/key_coder/key_coder.c

Overview

Parses strings of human readable text into a series of events

Events are meant to be processed by KeyCoder.post_event or Accessibility::Core#post.

Supports most, if not all, latin keyboard layouts, maybe some international layouts as well. Japanese layouts can be made to work with use of String#transform on MacRuby. See README for examples.

Defined Under Namespace

Classes: EventGenerator, Parser

Constant Summary collapse

VERSION =

Returns:

  • (String)
'1.0.0'

Instance Method Summary collapse

Instance Method Details

#keyboard_events_for(string) ⇒ Array<Array(Fixnum,Boolean)>

Generate keyboard events for the given string

Strings should be in a human readable format with a few exceptions. Command key (e.g. control, option, command) should be written in string as they appear in Accessibility::Keyboard::EventGenerator::CUSTOM.

For more details on event generation, read the Keyboarding wiki.

Parameters:

  • string (#to_s)

Returns:

  • (Array<Array(Fixnum,Boolean)>)


30
31
32
# File 'lib/accessibility/keyboard.rb', line 30

def keyboard_events_for string
  EventGenerator.new(Parser.new(string).parse).generate
end