Class: DidYouMean::Formatter
- Inherits:
-
Object
- Object
- DidYouMean::Formatter
- Defined in:
- lib/did_you_mean/formatter.rb
Instance Method Summary collapse
-
#initialize(corrections = []) ⇒ Formatter
constructor
A new instance of Formatter.
- #to_s ⇒ Object
Constructor Details
#initialize(corrections = []) ⇒ Formatter
Returns a new instance of Formatter.
5 6 7 |
# File 'lib/did_you_mean/formatter.rb', line 5 def initialize(corrections = []) @corrections = corrections end |
Instance Method Details
#to_s ⇒ Object
9 10 11 12 13 14 |
# File 'lib/did_you_mean/formatter.rb', line 9 def to_s return "" if @corrections.empty? output = "\nDid you mean? ".dup output << @corrections.join("\n ") end |