Method: YARD::CLI::Command#load_script

Defined in:
lib/yard/cli/command.rb

#load_script(file) ⇒ Object (protected)

Loads a Ruby script. If Config.options[:safe_mode] is enabled, this method will do nothing.

Parameters:

  • file (String)

    the path to the script to load

Since:

  • 0.6.2


64
65
66
67
68
69
70
# File 'lib/yard/cli/command.rb', line 64

def load_script(file)
  return if YARD::Config.options[:safe_mode]
  require(file.gsub(/\.rb$/, ''))
rescue LoadError => load_exception
  log.error "The file `#{file}' could not be loaded:\n#{load_exception}"
  exit
end