Sha256: 60b2a1fd850cf7c4e94a72a5f8a21cc237e3fae2c27060ab6bd2eb63c0f4678f
Contents?: true
Size: 1.35 KB
Versions: 28
Compression:
Stored size: 1.35 KB
Contents
{ "schema_type": "object", "schema_version": "1.0", "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
28 entries across 28 versions & 1 rubygems