Class: Mindee::V2::Parsing::Search::SearchModels
- Inherits:
-
Array
- Object
- Array
- Mindee::V2::Parsing::Search::SearchModels
- Defined in:
- lib/mindee/v2/parsing/search/search_models.rb
Overview
Array of search models.
Instance Method Summary collapse
-
#initialize(prediction) ⇒ SearchModels
constructor
A new instance of SearchModels.
-
#to_s ⇒ String
Default string representation.
Constructor Details
#initialize(prediction) ⇒ SearchModels
Returns a new instance of SearchModels.
9 10 11 |
# File 'lib/mindee/v2/parsing/search/search_models.rb', line 9 def initialize(prediction) super(prediction.map { |entry| SearchModel.new(entry) }) end |
Instance Method Details
#to_s ⇒ String
Default string representation.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mindee/v2/parsing/search/search_models.rb', line 15 def to_s return "\n" if empty? lines = flat_map do |model| [ "* :Name: #{model.name}", " :ID: #{model.id}", " :Model Type: #{model.model_type}", ] end # Joins all lines with a newline and appends a final newline # to perfectly match the C# StringBuilder output. "#{lines.join("\n")}\n" end |