Sha256: 560cae47c9b49a8b5bcaa1fc70a2d28a557ed8c92efcb5338494335132ca3527

Contents?: true

Size: 466 Bytes

Versions: 6

Compression:

Stored size: 466 Bytes

Contents

#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
# Copyright muflax <mail@muflax.com>, 2013
# License: GNU GPL 3 <http://www.gnu.org/copyleft/gpl.html>

def require_local lib_name, location=caller_locations.first.path
  file	= File.symlink?(location) ? File.readlink(location) : location
  dir 	= File.dirname(file)
  lib 	= File.join(dir, "#{lib_name}.rb")

  raise "couldn't find local module: «#{lib_name}» in «#{dir}»" if not File.exists? lib
  require lib
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
muflax-0.5.1 lib/muflax/library.rb
muflax-0.5.0 lib/muflax/library.rb
muflax-0.4.2 lib/muflax/library.rb
muflax-0.4.1 lib/muflax/library.rb
muflax-0.4.0 lib/muflax/library.rb
muflax-0.3.23 lib/muflax/library.rb