Sha256: 5304389aa6300d460834ac2d08c584cff56ecbec9ccc9884f26302345a15a10e

Contents?: true

Size: 793 Bytes

Versions: 5

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Reporters
      module Lines
        class Paragraph
          def initialize data = {}
            @data = data
          end

          def to_s
            %(#{label}"#{paragraph}"\n)
          end

          private

          attr_reader :data

          def label = "#{Line::DEFAULT_INDENT}Line #{number}: "

          def paragraph = formatted_lines.join("\n")

          def formatted_lines
            content.split("\n").map.with_index do |line, index|
              index.zero? ? line : "#{indent}#{line}"
            end
          end

          def indent = " " * (label.length + 1)

          def number = data.fetch(:number)

          def content = data.fetch(:content)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-lint-2.4.0 lib/git/lint/reporters/lines/paragraph.rb
git-lint-2.3.3 lib/git/lint/reporters/lines/paragraph.rb
git-lint-2.3.2 lib/git/lint/reporters/lines/paragraph.rb
git-lint-2.3.1 lib/git/lint/reporters/lines/paragraph.rb
git-lint-2.3.0 lib/git/lint/reporters/lines/paragraph.rb