Skip to content

ruby

The community/lang/ruby directory contains files that provide support for the Ruby programming language in Talon.

The file ruby.talon is a Talon file that defines the language tag for Ruby (code.language: ruby) and declares a number of tags used for code navigation and formatting, such as user.code_imperative, user.code_object_oriented, user.code_comment_line, and many more. It also sets some settings related to how functions and variables should be formatted using snake case. Finally, it provides some basic commands such as args pipe to insert | |, dock string to insert documentation comments (##), and instance to insert @ followed by a formatted variable name. It also defines some states, such as state end to insert "end", state begin to insert "begin", state rescue to insert "rescue ", and state module to insert "module ".

The file ruby.py is a Python file that defines actions specific to Ruby code. It defines a context that matches when the code.language is set to ruby. Inside of that context, it defines an action class UserActions that defines actions to insert various Ruby-specific code constructs such as operators, keywords, and common syntax.

These files work together to provide a comprehensive set of tools for writing Ruby code with Talon. The .talon file defines the language context and basic tags, while the .py file implements the actions that are triggered by voice commands. The settings defined in ruby.talon are used by functions defined in ruby.py.