Sha256: 008942606230c3b116c1e62586a32e5dd91312ea64d04c1292de14f8177ac913
Contents?: true
Size: 859 Bytes
Versions: 17
Compression:
Stored size: 859 Bytes
Contents
# frozen_string_literal: true module Git module Lint module Reporters module Lines # Reports paragraph details. class Paragraph def initialize data = {} @data = data end def to_s %(#{label}"#{paragraph}"\n) end alias to_str to_s 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
17 entries across 17 versions & 1 rubygems