<commit_before>require 'hat_trick/step_definition'

module HatTrick
  class Step
    attr_reader :step_def, :wizard
    attr_accessor :next_step
    attr_writer :skipped

    delegate :name, :fieldset, :buttons, :repeat_of, :to_sym, :to_s, :as_json,
             :run_after_callback, :run_before_callback, :repeat?,
             :run_include_data_callback, :include_data_key, :to => :step_def

    def initialize(step_def, wizard)
      @step_def = step_def
      @wizard = wizard
      @skipped = step_def.skipped?
    end

    def session
      wizard.session
    end

    def skipped?
      @skipped && !visited?
    end

    def visited?
      session["hat-trick.visited_steps"].include? self.to_sym
    end

    def mark_as_visited
      session["hat-trick.visited_steps"] << self.to_sym
    end
  end
end<commit_msg>init the visited_steps array if necessary<commit_after>require 'hat_trick/step_definition'

module HatTrick
  class Step
    attr_reader :step_def, :wizard
    attr_accessor :next_step
    attr_writer :skipped

    delegate :name, :fieldset, :buttons, :repeat_of, :to_sym, :to_s, :as_json,
             :run_after_callback, :run_before_callback, :repeat?,
             :run_include_data_callback, :include_data_key, :to => :step_def

    def initialize(step_def, wizard)
      @step_def = step_def
      @wizard = wizard
      @skipped = step_def.skipped?
    end

    def session
      wizard.session
    end

    def skipped?
      @skipped && !visited?
    end

    def visited?
      session["hat-trick.visited_steps"].include? self.to_sym
    end

    def mark_as_visited
      unless session.has_key?("hat-trick.visited_steps")
        session["hat-trick.visited_steps"] = []
      end
      session["hat-trick.visited_steps"] << self.to_sym
    end
  end
end
{'fraction_non_alphanumeric': 0.09569110240626749, 'fraction_numerical': 0.0, 'mean_word_length': 2.9296703296703295, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '620551', 'n_tokens_mistral': 621, 'n_tokens_neox': 602, 'n_words': 126}