Sha256: 39a873cdeb5c741984a1dd833b6e708a0f8dba0ecfa6b01bde4a0fcef1552f4b
Contents?: true
Size: 497 Bytes
Versions: 35
Compression:
Stored size: 497 Bytes
Contents
module Krikri::Enrichments ## # Enrichment to limit the number of characters in a string to 1000 # # @example: Limit a String # LimitCharacters.new.enrich_value(string_with_over_1000_characters) # => truncated string ending in '...' # class LimitCharacters include Audumbla::FieldEnrichment def enrich_value(value) return value unless value.is_a? String return value unless value.length > 1000 value.truncate(1000, separator: /\s/) end end end
Version data entries
35 entries across 35 versions & 1 rubygems