Sha256: 69f1c5c6380534d5dfa4ecfda375c8f7dd9207b8f5d02e8a7e345c8c1d1564b7

Contents?: true

Size: 843 Bytes

Versions: 1

Compression:

Stored size: 843 Bytes

Contents

require_dependency "delorean/application_controller"

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

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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
delorean_test_bed-0.0.2 app/controllers/delorean/flux_capacitor_controller.rb