Sha256: a6c390c718e69e1464939fdb58bfbb7b852afa9764201abd180d85dd7012b55d

Contents?: true

Size: 908 Bytes

Versions: 2

Compression:

Stored size: 908 Bytes

Contents

require_dependency "delorean_test_bed/application_controller"

module DeloreanTestBed
  class FluxCapacitorController < ApplicationController
    def index
      @scale = DeloreanTestBed::cache.read(:future).to_i
    end

    def start
      DeloreanTestBed::cache.write(:start, Time.now)
      Timecop.return
      redirect_to root_path
    end

    def pause
      DeloreanTestBed::cache.write(:pause, Time.now)
      Timecop.freeze(DeloreanTestBed::cache.read(:pause))
      redirect_to root_path
    end

    def flux
      DeloreanTestBed::cache.write(:scale, params[:scale])
      Timecop.scale(params[:scale].to_i)
      redirect_to root_path
    end

    def accelerate_to_eighty_eight
      DeloreanTestBed::cache.write(:future, DateTime.new(
        *params[:date].values.map(&:to_i)
      ))
      Timecop.travel(DeloreanTestBed::cache.read(:future))
      redirect_to root_path
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
delorean_test_bed-0.0.4 app/controllers/delorean_test_bed/flux_capacitor_controller.rb
delorean_test_bed-0.0.3 app/controllers/delorean_test_bed/flux_capacitor_controller.rb