Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update various bits of documentation

  • Loading branch information...
commit 0812edbd9a836df415a89f862b0ac2196fa4854e 1 parent cce9dcd
@ferrous26 ferrous26 authored
View
25 lib/accessibility/keyboard.rb
@@ -4,29 +4,26 @@
##
-# Parses strings of human readable text into a series of events meant to
-# be processed by {Accessibility::Core#post} or {KeyCoder.post_event}.
+# 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](https://github.com/AXElements/accessibility_core/blob/master/lib/accessibility/core/macruby.rb#L597).
#
# 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`.
-#
-# @example
-#
-# app = AXUIElementCreateApplication(3456)
-# include Accessibility::String
-# app.post keyboard_events_for "Hello, world!\n"
+# use of `String#transform` on MacRuby. See README for examples.
#
module Accessibility::Keyboard
##
- # Generate keyboard events for the given string. Strings should be in a
- # human readable with a few exceptions. Command key (e.g. control, option,
- # command) should be written in string as they appear in
- # {Accessibility::String::EventGenerator::CUSTOM}.
+ # 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](http://github.com/Marketcircle/AXElements/wiki/Keyboarding).
+ # [Keyboarding wiki](http://github.com/AXElements/AXElements/wiki/Keyboarding).
#
# @param string [#to_s]
# @return [Array<Array(Fixnum,Boolean)>]
View
5 lib/accessibility/keyboard/event_generator.rb
@@ -5,8 +5,9 @@
##
# Generate a sequence of keyboard events given a sequence of tokens.
-# The token format is defined by the {Lexer} class output; it is best
-# to use that class to generate the tokens.
+# The token format is defined by the
+# {Accessibility::Keyboard::EventGenerator}
+# class output; it is best to use that class to generate the tokens.
#
# @example
#
View
22 lib/accessibility/keyboard/parser.rb
@@ -9,10 +9,10 @@
#
# @example
#
-# Parser.new("Hai").lex # => ['H','a','i']
-# Parser.new("\\CONTROL").lex # => [["\\CONTROL"]]
-# Parser.new("\\COMMAND+a").lex # => [["\\COMMAND", ['a']]]
-# Parser.new("One\nTwo").lex # => ['O','n','e',"\n",'T','w','o']
+# Parser.new("Hai").parse # => ['H','a','i']
+# Parser.new("\\CONTROL").parse # => [["\\CONTROL"]]
+# Parser.new("\\COMMAND+a").parse # => [["\\COMMAND", ['a']]]
+# Parser.new("One\nTwo").parse # => ['O','n','e',"\n",'T','w','o']
#
class Accessibility::Keyboard::Parser
@@ -29,8 +29,8 @@ def initialize string
end
##
- # Tokenize the string that the lexer was initialized with and
- # return the sequence of tokens that were lexed.
+ # Tokenize the string that the parser was initialized with and
+ # return the sequence of tokens that were parsed.
#
# @return [Array<String,Array<String,...>]
def parse
@@ -38,9 +38,9 @@ def parse
@index = 0
while @index < length
@tokens << if custom?
- lex_custom
+ parse_custom
else
- lex_char
+ parse_char
end
@index += 1
end
@@ -65,7 +65,7 @@ def custom?
# @todo refactor
# @return [Array]
- def lex_custom
+ def parse_custom
start = @index
loop do
char = @chars[@index]
@@ -76,7 +76,7 @@ def lex_custom
else
tokens = custom_subseq start
@index += 1
- return tokens << lex_custom
+ return tokens << parse_custom
end
elsif char == SPACE
return custom_subseq start
@@ -95,7 +95,7 @@ def custom_subseq start
end
# @return [String]
- def lex_char
+ def parse_char
@chars[@index]
end
View
4 lib/accessibility/keyboard/version.rb
@@ -1,6 +1,8 @@
+##
+# Namespace for accessibility related objects
module Accessibility
module Keyboard
+ # @return [String]
VERSION = '1.0.0'
end
end
-
Please sign in to comment.
Something went wrong with that request. Please try again.