Class: Cliqr::InterfaceBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/cliqr/interface.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Builder for [Cliqr::CLI::Interface]

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Cliqr::CLI::ConfigBuilder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Start building a command line interface

interface (validated using CLI::Validator)

Parameters:

  • config (Cliqr::CLI::Config)

    the configuration options for the



80
81
82
# File 'lib/cliqr/interface.rb', line 80

def initialize(config)
  @config = config
end

Instance Method Details

#buildCliqr::CLI::Interface

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Validate and build a cli interface based on the configuration options

Returns:

  • (Cliqr::CLI::Interface)


90
91
92
93
94
95
96
# File 'lib/cliqr/interface.rb', line 90

def build
  fail Cliqr::Error::ConfigNotFound, 'a valid config should be defined' if @config.nil?
  fail Cliqr::Error::ValidationError, \
       "invalid Cliqr interface configuration - [#{@config.errors}]" unless @config.valid?

  Interface.new(@config)
end