Module: TestProf::RSpecDissect::MemoizedInstrumentation
- Defined in:
- lib/test_prof/rspec_dissect.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#fetch_or_store(id) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/test_prof/rspec_dissect.rb', line 20 def fetch_or_store(id, *) return super if id == :subject return @memoized[id] if @memoized[id] res = nil Thread.current[:_rspec_dissect_let_depth] ||= 0 Thread.current[:_rspec_dissect_let_depth] += 1 begin res = if Thread.current[:_rspec_dissect_let_depth] == 1 RSpecDissect.track(:let, name: id) { super } else super end ensure Thread.current[:_rspec_dissect_let_depth] -= 1 end res end |