# File lib/callsite.rb, line 7 def self.__DIR_REL__(called_from = nil) called_from ||= caller.first caller_path = parse(called_from).filename caller_path = '.' if caller_path == '' File.expand_path(File.dirname(caller_path)) end
# File lib/callsite.rb, line 59 def self.activate_all activate_string_methods activate_file_methods activate_module_methods activate_kernel_dir_methods activate_kernel_require_methods activate_loadpath_methods end
# File lib/callsite.rb, line 35 def self.activate_file_methods activate_kernel_dir_methods ::File.send(:extend, FileMethods) end
# File lib/callsite.rb, line 45 def self.activate_kernel_dir_methods require 'loaders/kernel_dir' end
# File lib/callsite.rb, line 49 def self.activate_kernel_require_methods activate_loadpath_methods require 'loaders/kernel_require' end
# File lib/callsite.rb, line 54 def self.activate_loadpath_methods activate_kernel_dir_methods require 'loaders/load_path' end
# File lib/callsite.rb, line 40 def self.activate_module_methods activate_kernel_dir_methods ::Module.send(:include, ModuleMethods) end
# File lib/callsite.rb, line 30 def self.activate_string_methods activate_kernel_dir_methods ::String.send(:include, StringMethods) end
# File lib/callsite.rb, line 14 def self.parse(input) if input.respond_to?(:backtrace) parse(input.backtrace) elsif input.is_a?(Array) block_given? ? input.each{|line| yield parse(line)} : input.map{|line| parse(line)} else if match = input.match(/^(.*?)(:(\d+))(:in `(.*)')?$/) Line.new(match[1], match[3].to_i, match[5]) else raise UnparsableCallLine.new("unable to parse #{input}") end end end