Class: Bond::Input
- Inherits:
-
String
- Object
- String
- Bond::Input
- 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
-
#argument ⇒ Object
Current argument number and array of argument strings.
-
#arguments ⇒ Object
Current argument number and array of argument strings.
-
#line ⇒ Object
readonly
The full line the user has typed.
-
#matched ⇒ Object
readonly
MatchData object from the matching mission (Mission#matched).
-
#object ⇒ Object
Actual object a user has just typed.
Instance Method Summary collapse
-
#initialize(str, options = {}) ⇒ Input
constructor
A new instance of Input.
- #inspect ⇒ Object
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, ={}) #@private super(str || '') @matched = [:matched] @line = [:line] @object = [:object] if [:object] @argument = [:argument] if [:argument] @arguments = [:arguments] if [:arguments] end |
Instance Attribute Details
#argument ⇒ Object
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 |
#arguments ⇒ Object
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 |
#line ⇒ Object (readonly)
The full line the user has typed.
13 14 15 |
# File 'lib/bond/input.rb', line 13 def line @line end |
#matched ⇒ Object (readonly)
MatchData object from the matching mission (Mission#matched).
9 10 11 |
# File 'lib/bond/input.rb', line 9 def matched @matched end |
#object ⇒ Object
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
#inspect ⇒ Object
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 |