Module: Need

Included in:
Object
Defined in:
lib/need.rb

Constant Summary collapse

VERSION =
'1.1.0'

Instance Method Summary collapse

Instance Method Details

#need(file = nil, &block) ⇒ Object

need takes a block which should contain a string of the relative path to the file you wish to need.



6
7
8
9
10
11
12
# File 'lib/need.rb', line 6

def need(file=nil, &block)
  if block_given?
    require File.expand_path(File.join(File.dirname(eval("__FILE__",block)),block.call))
  elsif file
    require File.expand_path(File.join(File.dirname(caller_file(1)),file))
  end
end