module RSpec::Core::Metadata::LocationKeys
def [](key)
def [](key) return super if has_key?(key) case key when :location store(:location, location) when :file_path, :line_number file_path, line_number = file_and_line_number store(:file_path, file_path) store(:line_number, line_number) self[key] else super end end
def file_and_line_number
def file_and_line_number first_caller_from_outside_rspec =~ /(.+?):(\d+)(|:\d+)/ return [$1, $2.to_i] end
def first_caller_from_outside_rspec
def first_caller_from_outside_rspec self[:caller].detect {|l| l !~ /\/lib\/rspec\/core/} end
def location
def location "#{self[:file_path]}:#{self[:line_number]}" end