Module: Kensho::RSpec::State
- Defined in:
- lib/kensho/rspec/state.rb
Constant Summary collapse
- THREAD_KEY =
:__kensho_rspec_scratch__- GROUP_STACK_KEY =
:__kensho_rspec_group_stack__
Class Attribute Summary collapse
-
.formatter ⇒ Object
Returns the value of attribute formatter.
Class Method Summary collapse
- .current ⇒ Object
- .current=(scratch) ⇒ Object
- .current_group ⇒ Object
- .pop_group ⇒ Object
- .push_group(group) ⇒ Object
Class Attribute Details
.formatter ⇒ Object
Returns the value of attribute formatter.
60 61 62 |
# File 'lib/kensho/rspec/state.rb', line 60 def formatter @formatter end |
Class Method Details
.current ⇒ Object
37 38 39 |
# File 'lib/kensho/rspec/state.rb', line 37 def self.current Thread.current[THREAD_KEY] end |
.current=(scratch) ⇒ Object
41 42 43 |
# File 'lib/kensho/rspec/state.rb', line 41 def self.current=(scratch) Thread.current[THREAD_KEY] = scratch end |
.current_group ⇒ Object
54 55 56 57 |
# File 'lib/kensho/rspec/state.rb', line 54 def self.current_group stack = Thread.current[GROUP_STACK_KEY] stack ? stack.last : nil end |
.pop_group ⇒ Object
49 50 51 52 |
# File 'lib/kensho/rspec/state.rb', line 49 def self.pop_group stack = Thread.current[GROUP_STACK_KEY] stack&.pop end |
.push_group(group) ⇒ Object
45 46 47 |
# File 'lib/kensho/rspec/state.rb', line 45 def self.push_group(group) (Thread.current[GROUP_STACK_KEY] ||= []) << group end |