Sha256: 73434facb3f8db909d7a2cb0e14353d5bfa1f949f9949d629d436dbe5bc2e59c

Contents?: true

Size: 825 Bytes

Versions: 9

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

module Pennyworth
  module CLI
    module Parsers
      SECTIONS = [Core, GitHub, RubyGems].freeze # Order is important.

      # Assembles and parses all Command Line Interface (CLI) options.
      class Assembler
        def initialize configuration = CLI::Configuration::Loader.call,
                       sections: SECTIONS,
                       client: CLIENT
          @configuration = configuration
          @sections = sections
          @client = client
        end

        def call arguments = []
          sections.each { |parser| parser.call configuration, client: client }
          client.parse! arguments
          configuration
        end

        def to_s = client.to_s

        private

        attr_reader :configuration, :client, :sections
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pennyworth-11.2.2 lib/pennyworth/cli/parsers/assembler.rb
pennyworth-11.2.1 lib/pennyworth/cli/parsers/assembler.rb
pennyworth-11.2.0 lib/pennyworth/cli/parsers/assembler.rb
pennyworth-11.1.3 lib/pennyworth/cli/parsers/assembler.rb
pennyworth-11.1.2 lib/pennyworth/cli/parsers/assembler.rb
pennyworth-11.1.1 lib/pennyworth/cli/parsers/assembler.rb
pennyworth-11.1.0 lib/pennyworth/cli/parsers/assembler.rb
pennyworth-11.0.1 lib/pennyworth/cli/parsers/assembler.rb
pennyworth-11.0.0 lib/pennyworth/cli/parsers/assembler.rb