Class: Pennyworth::CLI::Parsers::Assembler

Inherits:
Object
  • Object
show all
Defined in:
lib/pennyworth/cli/parsers/assembler.rb

Overview

Assembles and parses all Command Line Interface (CLI) options.

Instance Method Summary collapse

Constructor Details

#initialize(configuration = CLI::Configuration::Loader.call, sections: SECTIONS, client: CLIENT) ⇒ Assembler

Returns a new instance of Assembler.



10
11
12
13
14
15
16
# File 'lib/pennyworth/cli/parsers/assembler.rb', line 10

def initialize configuration = CLI::Configuration::Loader.call,
               sections: SECTIONS,
               client: CLIENT
  @configuration = configuration
  @sections = sections
  @client = client
end

Instance Method Details

#call(arguments = []) ⇒ Object



18
19
20
21
22
# File 'lib/pennyworth/cli/parsers/assembler.rb', line 18

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

#to_sObject



24
# File 'lib/pennyworth/cli/parsers/assembler.rb', line 24

def to_s = client.to_s