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

Version Path
ree_lib-1.0.32 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.31 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.30 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.29 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.28 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.27 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.26 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.24 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.23 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.22 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.21 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.20 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.19 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.18 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.17 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.16 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.15 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.14 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.13 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json
ree_lib-1.0.12 lib/ree_lib/packages/ree_string/schemas/ree_string/functions/truncate_bytes.schema.json