require "json"

module Support
  module Helpers
    class ScenarioVariables
      @variables = Hash.new { |hsh, key| hsh[key] = [] }

      def self.reset_scenario_variables
        @variables = Hash.new { |hsh, key| hsh[key] = [] }
      end

      def self.print_scenario_variables
        @variables.each do |hsh, key|
          new_value = key
          begin
            new_value = key[0].except(:password).to_s if key[0].slice(:password)
          rescue
            puts "No password in scenario variable #{hsh}"
          end
          puts hsh.to_s + " " + new_value.to_s
        end
      end

      def self.add_scenario_variable(variable_name, variable_value)
        @variables[variable_name].push(variable_value)
      end
    end
  end
end
