lib/bond/missions/object_mission.rb in bond-0.2.1 vs lib/bond/missions/object_mission.rb in bond-0.2.2
- old
+ new
@@ -2,26 +2,29 @@
# the condition must match and the current object must have an ancestor that matches :object.
# Note: To access to the current object being completed on within an action, use the input's
# object attribute.
#
# ==== Bond.complete Options:
-# [*:object*] String representing a module/class of object whose methods are completed.
-# [*:action*] If an action is not specified, the default action is to complete an object's
+# [:action] If an action is not specified, the default action is to complete an object's
# non-operator methods.
#
# ===== Example:
-# Bond.complete(:object=>ActiveRecord::Base) {|input| input.object.class.instance_methods(false) }
+# Bond.complete(:object=>'ActiveRecord::Base') {|input| input.object.class.instance_methods(false) }
class Bond::ObjectMission < Bond::Mission
- #:stopdoc:
OBJECTS = %w<\S+> + Bond::Mission::OBJECTS
CONDITION = '(OBJECTS)\.(\w*(?:\?|!)?)$'
- def initialize(options={})
+ def initialize(options={}) #@private
@object_condition = /^#{options[:object]}$/
options[:on] ||= Regexp.new condition_with_objects
super
end
+ def match_message #@private
+ "Matches completion for object with ancestor matching #{@object_condition.inspect}."
+ end
+
+ protected
def unique_id
"#{@object_condition.inspect}+#{@on.inspect}"
end
def do_match(input)
@@ -36,11 +39,6 @@
end
def default_action(obj)
obj.methods.map {|e| e.to_s} - OPERATORS
end
-
- def match_message
- "Matches completion for object with ancestor matching #{@object_condition.inspect}."
- end
- #:startdoc:
end
\ No newline at end of file