Class: CovLoupe::Commands::BaseCommand
- Inherits:
-
Object
- Object
- CovLoupe::Commands::BaseCommand
- Defined in:
- lib/cov_loupe/commands/base_command.rb
Overview
Base class for CLI subcommands. Provides shared behavior:
- Lazy model initialization via config.model_options
- Path-based argument handling with automatic error conversion
- Structured format output (JSON, YAML, etc.) with optional source code display
- Extra argument validation
Direct Known Subclasses
DetailedCommand, ListCommand, RawCommand, SummaryCommand, TotalsCommand, UncoveredCommand, ValidateCommand
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#source_formatter ⇒ Object
readonly
Returns the value of attribute source_formatter.
Instance Method Summary collapse
-
#initialize(cli_context) ⇒ BaseCommand
constructor
A new instance of BaseCommand.
Constructor Details
#initialize(cli_context) ⇒ BaseCommand
Returns a new instance of BaseCommand.
18 19 20 21 22 23 24 |
# File 'lib/cov_loupe/commands/base_command.rb', line 18 def initialize(cli_context) @cli = cli_context @config = cli_context.config @source_formatter = Formatters::SourceFormatter.new( **config. ) end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli.
26 27 28 |
# File 'lib/cov_loupe/commands/base_command.rb', line 26 def cli @cli end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
26 27 28 |
# File 'lib/cov_loupe/commands/base_command.rb', line 26 def config @config end |
#source_formatter ⇒ Object (readonly)
Returns the value of attribute source_formatter.
26 27 28 |
# File 'lib/cov_loupe/commands/base_command.rb', line 26 def source_formatter @source_formatter end |