How to dictate a Ruby method definition
Ruby method names are snake_case and often end in a question mark or an exclamation mark, both of which VoiceGem has phrases for. “def snake case fetch orders open paren snake case customer id close paren” returns def fetch_orders(customer_id) with nothing to fix.
An eleven-word Ruby definition takes about 13 seconds on the keyboard and about 4 seconds aloud. (sources: Dhakal, Feit, Kristensson & Oulasvirta, “Observations on Typing from 136 Million Keystrokes”, CHI 2018, 168,000 participants, 136 million keystrokes; Yuan, Liberman & Cieri, “Towards an Integrated Understanding of Speaking Rate in Conversation”, Interspeech 2006, 2,438 American English telephone conversations (Switchboard corpus). The speech figure is conversational rate, not a measured dictation rate — no such measurement exists.)
def fetch_orders(customer_id, include_archived)This tool runs entirely in your browser. Nothing you type is sent anywhere, stored, or logged.
Step by step
- 1
Say “def” then a casing command
Speak “def snake case fetch orders”. The keyword passes through and the casing command joins the two following words with an underscore.
- 2
Give each parameter its own command
Say “snake case” again inside the brackets. A VoiceGem casing run ends at the open paren, so a multi-word parameter needs a fresh command.
- 3
Say “question mark” or “bang” for a suffix
Speak the phrase after the name. The question mark attaches left and the exclamation mark attaches on both sides, so both bind flush against the method name.
- 4
Expect to tidy block parameters
Close the spaces around the pipes after dictating a block. The pipe entry is spaced for union types and shell pipelines, and Ruby wants the bars tight.
Ruby's predicate and bang suffixes both dictate correctly
Two naming conventions in Ruby put punctuation at the end of a method name, and both work. The question mark attaches to the left, so valid? comes out closed up; the exclamation mark attaches on both sides, so save! does too.
Neither is a special case in the Deterministic Pass. The attach flags that make these suffixes work were set for optional types and for negation, and Ruby's conventions happen to land on the right side of them — which is what a per-character model buys you compared with per-language rules.
Where the manual path breaks
Ruby is designed to be pleasant to type and a short def line is quick by hand. The language's whole aesthetic works against the case for dictating small things.
Block-heavy code is where the punctuation count rises. An each block with two parameters means two pipes, a comma and a do keyword, and the pipes need their spaces closed after dictating. For long method bodies the honest recommendation is to dictate the names and type the block syntax.
Doing this somewhere else? speech-to-code converter, with nothing to install, how dictating Bash functions works, dictating Go functions specifically, or dictating Java methods, step by step.
Common questions
Yes. Say “question mark” after the name and VoiceGem binds it flush, giving valid? with no space.
Say “bang” after the name. The exclamation mark attaches on both sides, so save! comes out closed up.
The pipe entry is spaced for TypeScript unions and shell pipelines. Close the gaps by hand, or type the block syntax and dictate the names.
Dictate a predicate and a bang method and check both suffixes.
Open the tool