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.
70 71 72 |
# File 'lib/kensho/rspec/state.rb', line 70 def formatter @formatter end |
Class Method Details
.current ⇒ Object
47 48 49 |
# File 'lib/kensho/rspec/state.rb', line 47 def self.current Thread.current[THREAD_KEY] end |
.current=(scratch) ⇒ Object
51 52 53 |
# File 'lib/kensho/rspec/state.rb', line 51 def self.current=(scratch) Thread.current[THREAD_KEY] = scratch end |
.current_group ⇒ Object
64 65 66 67 |
# File 'lib/kensho/rspec/state.rb', line 64 def self.current_group stack = Thread.current[GROUP_STACK_KEY] stack ? stack.last : nil end |
.pop_group ⇒ Object
59 60 61 62 |
# File 'lib/kensho/rspec/state.rb', line 59 def self.pop_group stack = Thread.current[GROUP_STACK_KEY] stack&.pop end |
.push_group(group) ⇒ Object
55 56 57 |
# File 'lib/kensho/rspec/state.rb', line 55 def self.push_group(group) (Thread.current[GROUP_STACK_KEY] ||= []) << group end |