class Samovar::Completion::Result
A collection of completion suggestions.
Attributes
@attribute [Array(Suggestion)] The suggestions in this result.
Public Class Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/samovar-2.5.1/lib/samovar/completion/result.rb, line 15 def initialize(suggestions = []) @suggestions = suggestions end
Initialize a new completion result.
@parameter suggestions [Array(Suggestion)] The suggestions in this result.
Public Instance Methods
Source
# File vendor/bundle/ruby/4.0.0/gems/samovar-2.5.1/lib/samovar/completion/result.rb, line 40 def +(other) self.class.new(@suggestions + other.suggestions) end
Combine this result with another result.
@parameter other [Result] The other result to append. @returns [Result] The combined result.
Source
# File vendor/bundle/ruby/4.0.0/gems/samovar-2.5.1/lib/samovar/completion/result.rb, line 25 def each(&block) @suggestions.each(&block) end
Iterate over each suggestion.
@yields {|suggestion| …} The block to call for each suggestion.
Source
# File vendor/bundle/ruby/4.0.0/gems/samovar-2.5.1/lib/samovar/completion/result.rb, line 32 def empty? @suggestions.empty? end
Whether this result contains no suggestions.
@returns [Boolean] True if there are no suggestions.
Source
# File vendor/bundle/ruby/4.0.0/gems/samovar-2.5.1/lib/samovar/completion/result.rb, line 47 def print(output = $stdout) each do |suggestion| output.puts suggestion.to_record end end
Print suggestions as tab-separated completion records.
@parameter output [IO] The output stream to write to.