Sha256: 34fb57c470b457aac2d4e6d12691cbb1128b8fbb4ccf1a1f476f7eb3f1d9935b

Contents?: true

Size: 803 Bytes

Versions: 4

Compression:

Stored size: 803 Bytes

Contents

require 'hat_trick/step_definition'

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

    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?
      not visited? and @skipped
    end

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

    def visited=(_visited)
      session["hat-trick.steps_visited"] << self.to_sym
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hat-trick-0.1.2 lib/hat_trick/step.rb
hat-trick-0.1.1 lib/hat_trick/step.rb
hat-trick-0.1.0 lib/hat_trick/step.rb
hat-trick-0.0.1 lib/hat_trick/step.rb