Class: CucumberTree::Handler::Variables
- Defined in:
- lib/cucumber_tree/handlers/variables.rb
Constant Summary collapse
- EXCLUDED_VARIABLES =
%w(@__cucumber_step_mother @__natural_language @integration_session @app @controller @response @request)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#load(snapshot) ⇒ Object
9 10 11 12 13 |
# File 'lib/cucumber_tree/handlers/variables.rb', line 9 def load(snapshot) snapshot[:variables].each do |name, value| world.instance_variable_set(name, value) end end |
#save(snapshot) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/cucumber_tree/handlers/variables.rb', line 15 def save(snapshot) names = world.instance_variables.map { |var| var.to_s } - EXCLUDED_VARIABLES snapshot[:variables] = {}.tap do |hash| names.each do |name| hash[name] = world.instance_variable_get(name) end end end |