Transmission::RPC::ClassicCodec
Translates between the shard's internal snake_case representation and
Transmission's classic on-the-wire dialect (hyphenated/camelCase keys,
camelCase responses).
The shard speaks snake_case everywhere internally (method names, argument
keys, the fields array, and the {Torrent}/etc. models). This module is
the single place that knows how to convert that to and from the classic
wire format, so the rest of the {Client} — and models.cr — stay
snake_case and protocol-agnostic.
Constants
Argument keys whose classic spelling is camelCase rather than the
default snake_case→hyphen conversion. Drawn from the Transmission
4.0.6 rpc-spec.md (torrent-set/session-set mutator tables): most
torrent-set keys are camelCase, while most session-set keys and the
torrent-add/torrent-remove keys are hyphenated. Anything not listed
here is converted snake_case→hyphen-ated.
Argument keys that pass through untouched (already protocol-neutral).
Instance methods
Converts an internal snake_case argument key to its classic form.
Passthrough keys are returned unchanged, keys in
{CLASSIC_KEY_EXCEPTIONS} get their camelCase spelling, and everything
else is hyphenated (download_dir → download-dir).
Converts a snake_case arguments hash into the classic key spelling,
also translating the few values that differ between dialects (the
recently_active ids selector).
Normalizes a classic response key to snake_case: hashString →
hash_string, and torrent-added → torrent_added (a handful of
classic response keys are hyphenated rather than camelCase). Idempotent
for already-snake_case input.
Converts a single snake_case torrent-get field name to the
camelCase form classic expects: hash_string → hashString,
percent_done → percentDone, id → id.
Converts an internal snake_case method name to its classic hyphenated
form: torrent_get → torrent-get.
hash_string → hashString. Leaves already-lowercase single words
untouched.