class Bond::AnywhereMission

A mission which completes anywhere i.e. even after non word break characters such as '[' or '}'. With options :prefix and :anywhere, this mission matches on the following regexp condition /:prefix?(:anywhere)$/ and passes the first capture group to the mission action.

Public Class Methods

new(options={}) click to toggle source
Calls superclass method Bond::Mission.new
# File lib/bond/missions/anywhere_mission.rb, line 6
def initialize(options={}) #@private
  options[:on] = Regexp.new("#{options[:prefix]}(#{options[:anywhere]})$")
  super
end

Public Instance Methods

after_match(input) click to toggle source
# File lib/bond/missions/anywhere_mission.rb, line 11
def after_match(input) #@private
  @completion_prefix = input.to_s.sub(/#{Regexp.escape(@matched[1])}$/, '')
  create_input @matched[1]
end