Sha256: 8d96069cead4fb711ea13ee93324b3862126d25e7ebec3da6b5eeb878437effb

Contents?: true

Size: 796 Bytes

Versions: 2

Compression:

Stored size: 796 Bytes

Contents

require 'require_smasher/version'
require 'require_smasher/require_gem'
require 'require_smasher/require_dir'

def require_all(*required_list)
  directories = []
  gems = []

  required_list.uniq.each do |required|
    directory = Dir.exist?(required)
    directories << required if directory
    gems << required unless directory
  end

  require_gem(gems) unless gems.empty?
  require_dir(directories) unless directories.empty?
end

def require_gem(gems)
  return RequireGem.req([gems]) if gems.instance_of?(String)
  RequireGem.req(gems)
end

def require_dir(directories)
  return RequireDir.req([directories]) if directories.instance_of?(String)
  RequireDir.req(directories)
end

def require_dirs(*directories)
  require_dir(directories)
end

def require_gems(*gems)
  require_gem(gems)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
require_smasher-0.2.1 lib/require_smasher.rb
require_smasher-0.2.0 lib/require_smasher.rb