Sha256: e39522f0a7f33b1a75b997bbadca6c23e72f2af18e73af2124c4fd0b7a57dc3c

Contents?: true

Size: 766 Bytes

Versions: 5

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

module Rubysmith
  module CLI
    module Parsers
      # Assembles and parses all Command Line Interface (CLI) options.
      class Assembler
        SECTIONS = [Core, Build].freeze # Order is important.

        def initialize sections: SECTIONS, client: CLIENT, container: Container
          @sections = sections
          @client = client
          @container = container
        end

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

        def to_s = client.to_s

        private

        attr_reader :sections, :client, :container

        def configuration = container[__method__]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubysmith-0.16.1 lib/rubysmith/cli/parsers/assembler.rb
rubysmith-0.16.0 lib/rubysmith/cli/parsers/assembler.rb
rubysmith-0.15.0 lib/rubysmith/cli/parsers/assembler.rb
rubysmith-0.14.0 lib/rubysmith/cli/parsers/assembler.rb
rubysmith-0.13.0 lib/rubysmith/cli/parsers/assembler.rb