Sha256: 97e460039ed6b1f7919072f42edc5dd83c06aea6c8bdf410eaa0d30ecc9ec498

Contents?: true

Size: 374 Bytes

Versions: 3

Compression:

Stored size: 374 Bytes

Contents

# frozen_string_literal: true

module Prompts
  class Paragraph
    include TextUtils

    LINE_PADDING = 3

    def initialize(text, width: 60)
      @text = text
      @width = width - (LINE_PADDING + 1)
      @line_padding = SPACE * LINE_PADDING
    end

    def lines
      wrap_text(@text, width: @width, line_prefix: @line_padding, alignment: :none)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prompts-0.3.1 lib/prompts/paragraph.rb
prompts-0.3.0 lib/prompts/paragraph.rb
prompts-0.2.1 lib/prompts/paragraph.rb