class FLACsmith::CLI::Parsers::Encode

Handles parsing of Command Line Interface (CLI) encode options.

Public Class Methods

call(...) click to toggle source
# File lib/flacsmith/cli/parsers/encode.rb, line 12
  def self.call(...) = new(...).call

  def initialize configuration = Container[:configuration], client: Parser::CLIENT
    @configuration = configuration
    @client = client
  end

  def call arguments = []
    client.separator "\nENCODE OPTIONS:\n"
    add_image
    client.parse arguments
    configuration
  end

  private

  attr_reader :configuration, :client

  def add_image
    client.on "-i", "--image PATH", "Album image file path." do |path|
      configuration.merge! image_path: path
    end
  end
end
new(configuration = Container[:configuration], client: Parser::CLIENT) click to toggle source
# File lib/flacsmith/cli/parsers/encode.rb, line 14
def initialize configuration = Container[:configuration], client: Parser::CLIENT
  @configuration = configuration
  @client = client
end

Public Instance Methods

add_image() click to toggle source
# File lib/flacsmith/cli/parsers/encode.rb, line 30
def add_image
  client.on "-i", "--image PATH", "Album image file path." do |path|
    configuration.merge! image_path: path
  end
end
call(arguments = []) click to toggle source
# File lib/flacsmith/cli/parsers/encode.rb, line 19
def call arguments = []
  client.separator "\nENCODE OPTIONS:\n"
  add_image
  client.parse arguments
  configuration
end