Module: Rbcli::Configurate

Defined in:
lib/rbcli/components/core/configurate.rb

Overview

Rbcli – A framework for developing command line applications in Ruby #

Copyright (C) 2024 Andrew Khoury <[email protected]>                        #

Defined Under Namespace

Modules: Cli, Config, Envvars, Hooks, Logger, UpdateChecker

Class Method Summary collapse

Class Method Details

.method_missing(method, *args, &block) ⇒ Object

If a non-existant method is called, we attempt to load the plugin. If the plugin fails to load we display a message to the developer



9
10
11
12
13
14
15
16
17
# File 'lib/rbcli/components/core/configurate.rb', line 9

def self.method_missing(method, *args, &block)
  filename = File.join(RBCLI_LIBDIR, 'plugins', method.to_s.downcase, 'component.rb')
  if File.exist? filename
    require filename
    self.send method, *args, &block
  else
    raise Rbcli::ConfigurateError.new "Invalid Rbcli Configurate plugin called: `#{method}` in file #{File.expand_path caller[0]}"
  end
end