Sha256: feb4c63d94c5f95404eeb93b664565ae14f47260b98b07bdd1eb3400e69dca8e

Contents?: true

Size: 332 Bytes

Versions: 1

Compression:

Stored size: 332 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: '.', indicator_length: 3)
    return self if size < limit

    [self[0...limit], (more_indicator * indicator_length)].join
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
render-text-helper-0.3.0 lib/render/text/helper/string.rb