Sha256: a86409647c2cd0cb0a2df6850adea967b4aa2204d7ac1ae2565736189134c997

Contents?: true

Size: 472 Bytes

Versions: 3

Compression:

Stored size: 472 Bytes

Contents

#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
# Copyright Steffie Dorn <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

3 entries across 3 versions & 1 rubygems

Version Path
muflax-0.5.5 lib/muflax/library.rb
muflax-0.5.3 lib/muflax/library.rb
muflax-0.5.2 lib/muflax/library.rb