Class: Rigor::CLI::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/rigor/cli/command.rb

Overview

Base class for the ‘rigor <subcommand>` command objects.

Every subcommand captured the same invariant wiring — the argument vector plus the output and error streams — in an identical ‘initialize(argv:, out:, err:)`, and defaulted the streams inconsistently (some to `$stdout` / `$stderr`, most not at all). Centralising it here gives one consistent shape and lets a test instantiate a command with just `argv:` (the streams default so a spec can pass a `StringIO` for one and ignore the other).

Subclasses read the ‘@argv` / `@out` / `@err` ivars directly, as they did before.

Instance Method Summary collapse

Constructor Details

#initialize(argv:, out: $stdout, err: $stderr) ⇒ Command

Returns a new instance of Command.



18
19
20
21
22
# File 'lib/rigor/cli/command.rb', line 18

def initialize(argv:, out: $stdout, err: $stderr)
  @argv = argv
  @out = out
  @err = err
end