Class: Lutaml::Xsd::Commands::ElementCommand::ByNamespaceCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/lutaml/xsd/commands/element_command.rb

Overview

ByNamespace command implementation

Instance Attribute Summary

Attributes inherited from BaseCommand

#options

Instance Method Summary collapse

Constructor Details

#initialize(package_path, options) ⇒ ByNamespaceCommand

Returns a new instance of ByNamespaceCommand.



555
556
557
558
# File 'lib/lutaml/xsd/commands/element_command.rb', line 555

def initialize(package_path, options)
  super(options)
  @package_path = package_path
end

Instance Method Details

#runObject



560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'lib/lutaml/xsd/commands/element_command.rb', line 560

def run
  repository = load_repository(@package_path)
  repository = ensure_resolved(repository)

  elements = repository.elements_by_namespace(
    namespace_uri: options[:namespace],
  )

  case options[:format]
  when "json", "yaml"
    output format_output(elements, options[:format])
  else
    display_text_output(elements, repository)
  end
end