class Result
A collection of completion suggestions.
Definitions
def initialize(suggestions = [])
Initialize a new completion result.
Signature
-
parameter
suggestionsArray(Suggestion) The suggestions in this result.
Implementation
def initialize(suggestions = [])
@suggestions = suggestions
end
attr :suggestions
Signature
-
attribute
Array(Suggestion) The suggestions in this result.
def each(&block)
Iterate over each suggestion.
Signature
-
yields
{|suggestion| ...} The block to call for each suggestion.
Implementation
def each(&block)
@suggestions.each(&block)
end
def empty?
Whether this result contains no suggestions.
Signature
-
returns
Boolean True if there are no suggestions.
Implementation
def empty?
@suggestions.empty?
end
def +(other)
Combine this result with another result.
Signature
-
parameter
otherResult The other result to append.
-
returns
Result The combined result.
Implementation
def +(other)
self.class.new(@suggestions + other.suggestions)
end
def print(output = $stdout)
Print suggestions as tab-separated completion records.
Signature
-
parameter
outputIO The output stream to write to.
Implementation
def print(output = $stdout)
each do |suggestion|
output.puts suggestion.to_record
end
end