Sha256: 975fa8869af0001c468fd91624cf1762c5082e0be9eb40cf0232d4df0b060df8

Contents?: true

Size: 322 Bytes

Versions: 2

Compression:

Stored size: 322 Bytes

Contents

# frozen_string_literal: true

# Adds function to existing String class
class String
  # output the string giving the limit. It does not touch the string
  def limit_print(limit: 32, more_indicator: '.')
    return self if size < limit

    [self[0...limit], more_indicator, more_indicator, more_indicator].join
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
render-text-helper-0.2.0 lib/render/text/helper/string.rb
render-text-helper-0.1.0 lib/render/text/helper/string.rb