Sha256: 057148724fb0c0b02db93dc023b00828772160ea011b026be1d81b8f1a315723
Contents?: true
Size: 1.35 KB
Versions: 4
Compression:
Stored size: 1.35 KB
Contents
{ "schema_type": "object", "ree_version": "1.0.1", "name": "truncate_bytes", "path": "packages/ree_string/package/ree_string/functions/truncate_bytes.rb", "mount_as": "fn", "class": "ReeString::TruncateBytes", "factory": null, "methods": [ { "doc": "Truncates +text+ to at most <tt>bytesize</tt> bytes in length without\nbreaking string encoding by splitting multibyte characters or breaking\ngrapheme clusters (\"perceptual characters\") by truncating at combining\ncharacters.\n\n >> \"🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪\".size\n => 20\n >> \"🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪\".bytesize\n => 80\n >> truncate_bytes(\"🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪\", 20)\n => \"🔪🔪🔪🔪…\"\n\nThe truncated text ends with the <tt>:omission</tt> string, defaulting\nto \"…\", for a total length not exceeding <tt>bytesize</tt>.", "throws": [ "ArgumentError" ], "return": "String", "args": [ { "arg": "str", "type": "String" }, { "arg": "truncate_at", "type": "Integer" }, { "arg": "opts", "type": "Ksplat[:omission? => String]" } ] } ], "links": [ ] }
Version data entries
4 entries across 4 versions & 1 rubygems