Sha256: 8cf2228cf81bdddc54177afb0944d8694d8ceea8e4cb6683de08ea2d4bfaf0c1

Contents?: true

Size: 607 Bytes

Versions: 10

Compression:

Stored size: 607 Bytes

Contents

# 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.
class Bond::AnywhereMission < Bond::Mission
  def initialize(options={}) #@private
    options[:on] = Regexp.new("#{options[:prefix]}(#{options[:anywhere]})$")
    super
  end

  def after_match(input) #@private
    @completion_prefix = input.to_s.sub(/#{Regexp.escape(@matched[1])}$/, '')
    create_input @matched[1]
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bond-0.5.1 lib/bond/missions/anywhere_mission.rb
bond-0.5.1-java lib/bond/missions/anywhere_mission.rb
bond-0.5.0 lib/bond/missions/anywhere_mission.rb
bond-0.5.0-java lib/bond/missions/anywhere_mission.rb
bond-0.4.3 lib/bond/missions/anywhere_mission.rb
bond-0.4.3-java lib/bond/missions/anywhere_mission.rb
bond-0.4.2 lib/bond/missions/anywhere_mission.rb
bond-0.4.2-java lib/bond/missions/anywhere_mission.rb
bond-0.4.1 lib/bond/missions/anywhere_mission.rb
bond-0.4.0 lib/bond/missions/anywhere_mission.rb