Class: Rubysmith::CLI::Parsers::Assembler

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

Overview

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

Constant Summary collapse

SECTIONS =

Order is important.

[Core, Build].freeze

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/rubysmith/cli/parsers/assembler.rb', line 10

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

Instance Method Details

#call(arguments = []) ⇒ Object



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

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

#to_hObject



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

def to_h = options

#to_sObject



26
# File 'lib/rubysmith/cli/parsers/assembler.rb', line 26

def to_s = client.to_s