Class: Dosh::Require

Inherits:
Script show all
Defined in:
lib/script.rb

Instance Method Summary collapse

Methods inherited from Script

#candidate_files, #resolve_file, #script

Constructor Details

#initialize(filename, args) ⇒ Require

Returns a new instance of Require.



96
97
98
99
# File 'lib/script.rb', line 96

def initialize(filename, args)
  @filename = filename
  @args = args
end

Instance Method Details

#runObject



101
102
103
104
105
106
# File 'lib/script.rb', line 101

def run
  raise "File '#{command}' not found" if @filename.nil?
  ARGV.clear
  @args.each { |a| ARGV << a }
  require(@filename)
end