Sha256: 33dcbdf614c1cda80e6c21fce48b91450f6f82f6adcb8b609a6dabc6ffe58703

Contents?: true

Size: 475 Bytes

Versions: 3

Compression:

Stored size: 475 Bytes

Contents

module Mengpaneel
  class Delayer
    SESSION_KEY = "mengpaneel_delayed_calls".freeze

    attr_reader :controller

    def initialize(controller = nil)
      @controller = controller
    end

    def load
      (controller.session[SESSION_KEY] || {}).with_indifferent_access
    end

    def load!
      calls = load
      controller.session.delete(SESSION_KEY)
      calls
    end

    def save(all_calls)
      controller.session[SESSION_KEY] = all_calls
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mengpaneel-0.0.3 lib/mengpaneel/delayer.rb
mengpaneel-0.0.2 lib/mengpaneel/delayer.rb
mengpaneel-0.0.1 lib/mengpaneel/delayer.rb