Class: RSpec::Core::Metadata::HashPopulator
- Inherits:
-
Object
- Object
- RSpec::Core::Metadata::HashPopulator
- Defined in:
- opal/opal/rspec/fixes/rspec/core/metadata.rb
Instance Method Summary collapse
Instance Method Details
#populate_location_attributes ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'opal/opal/rspec/fixes/rspec/core/metadata.rb', line 3 def populate_location_attributes backtrace = .delete(:caller) # Throwing exceptions to get code location is expensive, so use this if the user supplied it, otherwise # keep empty stuff around so filter code does not crash # might have an empty array from caller which file_path_and_line_number_from doesn't like file_path, line_number = if backtrace && !backtrace.empty? file_path_and_line_number_from(backtrace) else ['', -1] end [:file_path] = file_path [:line_number] = line_number.to_i [:location] = file_path.empty? ? '' : "#{file_path}:#{line_number}" end |