Class: Tabry::CLI::AllInOne::AllInOneBase

Inherits:
Base
  • Object
show all
Defined in:
lib/tabry/cli/all_in_one.rb

Instance Attribute Summary

Attributes inherited from Base

#args, #flags, #internals

Class Method Summary collapse

Methods inherited from Base

after_action, before_action, #initialize, sub_route

Constructor Details

This class inherits a constructor from Tabry::CLI::Base

Class Method Details

.config(opts = {}, &blk) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tabry/cli/all_in_one.rb', line 14

def self.config(opts = {}, &blk)
  require_relative "../models/config"
  if opts.is_a?(Tabry::Models::Config)
    conf = opts
  else
    require_relative "../config_builder"
    conf = Tabry::ConfigBuilder.build(**opts, &blk)
  end

  # Set it in the CLI class itself so AllInOne.build can find it
  instance_variable_set(:@tabry_all_in_one_config, conf)

  # Hack to avoid processing block any more if only running completion
  # That way you an have expensive requires after the include
  if ((ARGV.first == "completion")) && ARGV.length == 3 && ARGV[2].to_s =~ /^[0-9]+$/
    throw :run_completion, true
  end
end