Permalink
Browse files

Add various docstrings

  • Loading branch information...
1 parent 0c3d934 commit c3230e32187a6717275dc2509e7d8f7146a28f87 @ferrous26 ferrous26 committed Apr 18, 2012
@@ -107,6 +107,13 @@ keycoder_post_event(VALUE self, VALUE event)
void
Init_key_coder()
{
+ /*
+ * Document-class: KeyCoder
+ *
+ * Class that encapsulates some low level work for finding key code mappings
+ * and posting keyboard events to the system.
+ *
+ */
VALUE cKeyCoder = rb_define_class("KeyCoder", rb_cObject);
rb_define_singleton_method(cKeyCoder, "dynamic_mapping", keycoder_dynamic_mapping, 0);
rb_define_singleton_method(cKeyCoder, "post_event", keycoder_post_event, 1);
@@ -4,6 +4,9 @@
# Error raised when an implicit search fails to return a result.
class Accessibility::SearchFailure < NoMethodError
+ # @param [AX::Element]
+ # @param [#to_s]
+ # @param [Hash{Symbol=>Object}]
def initialize searcher, searchee, filters
filters = {} unless filters.kind_of? Hash
msg = "Could not find `#{pp_searchee searchee, filters}` "
@@ -17,14 +20,17 @@ def initialize searcher, searchee, filters
private
+ # Nice string representation of what was being searched for
def pp_searchee searchee, filters
Accessibility::Qualifier.new(searchee, filters).describe
end
+ # Nice string representation of element's path from the application root
def path_to element
Accessibility::Debug.path(element).map! { |x| x.inspect }.join("\n\t")
end
+ # Nice string representation of the subtree underneath the searcher
def debug searcher
Accessibility::Debug.text_subtree(searcher)
end
@@ -159,16 +159,12 @@ def init_singularizations
##
# @private
#
- # Cached for performance.
- #
# @return [String]
EMPTY_STRING = ''
##
# @private
#
- # Performance hack.
- #
# @return [String]
QUESTION_MARK = '?'
end
@@ -1,12 +1,21 @@
require 'awesome_print'
+##
+# `AwesomePrint` extension for AXElements.
module AwesomePrint::AXElements
+ ##
+ # Perform the silly `alias_method_chain` stuff that AwesomePrint
+ # expects.
def self.included base
base.send :alias_method, :cast_without_ax_elements, :cast
base.send :alias_method, :cast, :cast_with_ax_elements
end
+ ##
+ # Format {AX::Element} objects for AwesomePrint. For the time
+ # being, just work-around the default AwesomePrint output by
+ # using the default `#inpspect` for {AX::Element}.
def cast_with_ax_elements object, type
cast = cast_without_ax_elements object, type
cast = :ax_element if object.kind_of? ::AX::Element
@@ -2,6 +2,11 @@
# Workaround for MacRuby ticket #1334
class Exception
alias_method :original_message, :message
+ #
+ # Override the message method to force the backtrace to be
+ # included.
+ #
+ # @return [String]
def message
"#{original_message}\n\t#{backtrace.join("\n\t")}"
end

0 comments on commit c3230e3

Please sign in to comment.