Class/Module Index [+]

Quicksearch

RSpec::Core::Metadata::LocationKeys

Public Instance Methods

[](key) click to toggle source
# File lib/rspec/core/metadata.rb, line 6
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
file_and_line_number() click to toggle source
# File lib/rspec/core/metadata.rb, line 25
def file_and_line_number
  first_caller_from_outside_rspec =~ /(.+?):(\d+)(|:\d+)/
  return [$1, $2.to_i]
end
first_caller_from_outside_rspec() click to toggle source
# File lib/rspec/core/metadata.rb, line 30
def first_caller_from_outside_rspec
  self[:caller].detect {|l| l !~ /\/lib\/rspec\/core/}
end
location() click to toggle source
# File lib/rspec/core/metadata.rb, line 21
def location
  "#{self[:file_path]}:#{self[:line_number]}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.