Class: Bond::ObjectMission
- Defined in:
- lib/bond/missions/object_mission.rb
Overview
A mission which completes an object’s methods. For this mission to match, 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:
- :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) }
Constant Summary collapse
Constants inherited from Mission
Instance Attribute Summary
Attributes inherited from Mission
#action, #matched, #on, #place
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ObjectMission
constructor
A new instance of ObjectMission.
- #match_message ⇒ Object
Methods inherited from Mission
#call_action, #call_search, #condition, create, current_eval, #execute, #matches?, #name
Constructor Details
#initialize(options = {}) ⇒ ObjectMission
Returns a new instance of ObjectMission.
15 16 17 18 19 |
# File 'lib/bond/missions/object_mission.rb', line 15 def initialize(={}) #@private @object_condition = /^#{[:object]}$/ [:on] ||= Regexp.new condition_with_objects super end |
Instance Method Details
#match_message ⇒ Object
21 22 23 |
# File 'lib/bond/missions/object_mission.rb', line 21 def #@private "Matches completion for object with ancestor matching #{@object_condition.inspect}." end |