Class: Bond::Input

Inherits:
String
  • Object
show all
Defined in:
lib/bond/input.rb

Overview

A string representing the last word the user has typed. This string is passed to a mission action to generate possible completions. This string contains a number of attributes from the matching mission, useful in generating completions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, options = {}) ⇒ Input

Returns a new instance of Input.



14
15
16
17
18
19
20
21
# File 'lib/bond/input.rb', line 14

def initialize(str, options={}) #@private
  super(str || '')
  @matched = options[:matched]
  @line = options[:line]
  @object = options[:object] if options[:object]
  @argument = options[:argument] if options[:argument]
  @arguments = options[:arguments] if options[:arguments]
end

Instance Attribute Details

#argumentObject

Current argument number and array of argument strings. Used by MethodMission.



11
12
13
# File 'lib/bond/input.rb', line 11

def argument
  @argument
end

#argumentsObject

Current argument number and array of argument strings. Used by MethodMission.



11
12
13
# File 'lib/bond/input.rb', line 11

def arguments
  @arguments
end

#lineObject (readonly)

The full line the user has typed.



13
14
15
# File 'lib/bond/input.rb', line 13

def line
  @line
end

#matchedObject (readonly)

MatchData object from the matching mission (Mission#matched).



9
10
11
# File 'lib/bond/input.rb', line 9

def matched
  @matched
end

#objectObject

Actual object a user has just typed. Used by MethodMission and ObjectMission.



7
8
9
# File 'lib/bond/input.rb', line 7

def object
  @object
end

Instance Method Details

#inspectObject



23
24
25
26
# File 'lib/bond/input.rb', line 23

def inspect #@private
  "#<Bond::Input #{self.to_s.inspect} @matched=#{@matched.to_a.inspect} @line=#{@line.inspect} "+
  "@argument=#{@argument.inspect} @arguments=#{@arguments.inspect} @object=#{@object.inspect}>"
end