Module: MustBeOrdered::StackTraceFilter

Included in:
RelationCheck
Defined in:
lib/must_be_ordered/stack_trace_filter.rb

Constant Summary collapse

VENDOR_PATH =
'/vendor'

Instance Method Summary collapse

Instance Method Details

#caller_in_projectObject



5
6
7
8
9
10
11
12
13
# File 'lib/must_be_ordered/stack_trace_filter.rb', line 5

def caller_in_project
  app_root = defined?(::Rails) ? Rails.root.to_s : Dir.pwd
  vendor_root = app_root + VENDOR_PATH
  bundler_path = Bundler.bundle_path.to_s
  select_caller_locations do |location|
    caller_path = location_as_path(location)
    caller_path.include?(app_root) && !caller_path.include?(vendor_root) && !caller_path.include?(bundler_path)
  end
end