Module: ElasticGraph::ProtoIngestion::SchemaDefinition::SchemaElements::ProtoDocumentation Private

Defined in:
elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/schema_elements/proto_documentation.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Formats ElasticGraph schema element documentation as protobuf comments.

Class Method Summary collapse

Class Method Details

.comment_lines_for(doc_comment, indent: "") ⇒ Array<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Formats documentation as line comments.

Parameters:

  • doc_comment (String, nil)

    schema element documentation

  • indent (String) (defaults to: "")

    indentation to put before each comment

Returns:

  • (Array<String>)

    formatted protobuf comment lines



22
23
24
25
26
27
28
# File 'elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/schema_elements/proto_documentation.rb', line 22

def self.comment_lines_for(doc_comment, indent: "")
  return [] unless doc_comment

  doc_comment.chomp.lines(chomp: true).map do |line|
    line.empty? ? "#{indent}//" : "#{indent}// #{line}"
  end
end