Top Level Namespace

Defined Under Namespace

Modules: Classifier, FileSmasher, RequireFile, RequireSmasher Classes: BaseError, DirNotExistError, DirNotInformedError, FileNotInformedError, GemNotInformedError, NotExistError, NotInformedError, RequireFileError

Instance Method Summary collapse

Instance Method Details

#require_all(*required_list) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/require_smasher.rb', line 16

def require_all(*required_list)
  classified = Classifier.classify(required_list)
  files = classified[:files]

  classified[:gems].uniq.each { |gem| require gem }
  RequireFile.require(files) unless files.empty?
end

#require_dir(directory) ⇒ Object



29
30
31
# File 'lib/require_smasher.rb', line 29

def require_dir(directory)
  RequireFile.require_directories([directory])
end

#require_dirs(*directories) ⇒ Object



38
39
40
# File 'lib/require_smasher.rb', line 38

def require_dirs(*directories)
  RequireFile.require_directories(directories)
end

#require_file(file) ⇒ Object



33
34
35
36
# File 'lib/require_smasher.rb', line 33

def require_file(file)
  require_relative File.expand_path("./#{file}")
  nil
end

#require_files(*files) ⇒ Object



48
49
50
# File 'lib/require_smasher.rb', line 48

def require_files(*files)
  RequireFile.require(files)
end

#require_gem(gem) ⇒ Object



24
25
26
27
# File 'lib/require_smasher.rb', line 24

def require_gem(gem)
  require gem
  gem
end

#require_gems(*gems) ⇒ Object



42
43
44
45
46
# File 'lib/require_smasher.rb', line 42

def require_gems(*gems)
  raise GemNotInformedError if gems.empty?

  gems.uniq.each { |gem| require gem }
end