Module: Basepath

Extended by:
Basepath
Included in:
Basepath
Defined in:
lib/basepath.rb

Instance Method Summary collapse

Instance Method Details

#const_expand!(s) ⇒ Object

used when settings consts and load_path



13
14
15
# File 'lib/basepath.rb', line 13

def const_expand!(s)
  (s.sub!(RX_CONSTS, '') ? Object.const_get($1) : ::BASE_PATH).join(s);
end

#mine(file = false) ⇒ Object



6
7
8
9
10
# File 'lib/basepath.rb', line 6

def mine(file = false)
  path_to_first_caller = (s = caller.last) ? s.sub(/:\d+(?::in `.*?')?$/, '') : __FILE__
  path = Pathname.new(path_to_first_caller).realpath
  file ? path : path.dirname
end