Class: Lutaml::Cli::Commands::BaseCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/cli/commands/base_command.rb

Overview

BaseCommand provides common functionality for all command handlers

All command classes should inherit from this base class to access common utilities like repository loading, error handling, and output formatting.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository = nil, options = {}) ⇒ BaseCommand

Initialize command with repository and options

Repository instance

Parameters:



21
22
23
24
# File 'lib/lutaml/cli/commands/base_command.rb', line 21

def initialize(repository = nil, options = {})
  @repository = repository
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



14
15
16
# File 'lib/lutaml/cli/commands/base_command.rb', line 14

def options
  @options
end

#repositoryObject (readonly)

Returns the value of attribute repository.



14
15
16
# File 'lib/lutaml/cli/commands/base_command.rb', line 14

def repository
  @repository
end

Instance Method Details

#executeObject

Execute the command (to be implemented by subclasses)

Raises:

  • (NotImplementedError)

    If not overridden by subclass



29
30
31
32
# File 'lib/lutaml/cli/commands/base_command.rb', line 29

def execute
  raise NotImplementedError,
        "#{self.class.name} must implement #execute"
end