Class: FactoryBotProfile::Stack

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_bot_profile/stack.rb

Instance Method Summary collapse

Constructor Details

#initializeStack

Returns a new instance of Stack.



5
6
7
# File 'lib/factory_bot_profile/stack.rb', line 5

def initialize
  @stack = []
end

Instance Method Details

#<<(name) ⇒ Object



9
10
11
# File 'lib/factory_bot_profile/stack.rb', line 9

def <<(name)
  @stack << Frame.new(name)
end

#popObject



13
14
15
16
17
18
# File 'lib/factory_bot_profile/stack.rb', line 13

def pop
  @stack.pop.tap do |frame|
    frame.finish!
    @stack.last.observe_child(frame) unless @stack.empty?
  end
end