Sha256: a33d1714c48f7daa5796be05ed0c5e225879df9c52b5fedc79aa3e18a533cfbc

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

module AnnotateRb
  module ModelAnnotator
    module IndexAnnotation
      class AnnotationBuilder
        def initialize(model, options)
          @model = model
          @options = options
        end

        def build
          return Components::NilComponent.new if !@options[:show_indexes]

          indexes = @model.retrieve_indexes_from_table
          return Components::NilComponent.new if indexes.empty?

          max_size = indexes.map { |index| index.name.size }.max + 1

          indexes = indexes.sort_by(&:name).map do |index|
            IndexComponent.new(index, max_size)
          end

          _annotation = Annotation.new(indexes)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
annotaterb-4.13.0 lib/annotate_rb/model_annotator/index_annotation/annotation_builder.rb
annotaterb-4.12.0 lib/annotate_rb/model_annotator/index_annotation/annotation_builder.rb
annotaterb-4.11.0 lib/annotate_rb/model_annotator/index_annotation/annotation_builder.rb
annotaterb-4.10.2 lib/annotate_rb/model_annotator/index_annotation/annotation_builder.rb