Class: Rigor::CLI::TypeOfCommand
- Inherits:
-
Object
- Object
- Rigor::CLI::TypeOfCommand
- Defined in:
- lib/rigor/cli/type_of_command.rb
Overview
Executes the ‘rigor type-of` command.
The command is a thin probe over ‘Rigor::Scope#type_of`: it locates the deepest expression at a `(file, line, column)` triple and prints the inferred type, RBS erasure, and (optionally) the recorded fail-soft fallbacks.
Encapsulating the command in its own class keeps ‘Rigor::CLI` focused on dispatching and lets us evolve the type-of UX (extra flags, watch mode, streaming output) without bloating the CLI shell. Output formatting is delegated to TypeOfRenderer.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- USAGE =
"Usage: rigor type-of [options] FILE:LINE:COL"
Instance Method Summary collapse
-
#initialize(argv:, out:, err:) ⇒ TypeOfCommand
constructor
A new instance of TypeOfCommand.
-
#run ⇒ Integer
CLI exit status.
Constructor Details
#initialize(argv:, out:, err:) ⇒ TypeOfCommand
Returns a new instance of TypeOfCommand.
31 32 33 34 35 |
# File 'lib/rigor/cli/type_of_command.rb', line 31 def initialize(argv:, out:, err:) @argv = argv @out = out @err = err end |
Instance Method Details
#run ⇒ Integer
Returns CLI exit status.
38 39 40 41 42 43 44 45 |
# File 'lib/rigor/cli/type_of_command.rb', line 38 def run = target = parse_position_argument(@argv) return CLI::EXIT_USAGE if target.nil? execute(target: target, options: ) end |