Sha256: 8f88c157f8482673fa5e2674512cc20f48a00be03b4da647d1662fed2edfeec1

Contents?: true

Size: 587 Bytes

Versions: 1

Compression:

Stored size: 587 Bytes

Contents

module Nyara
  # convenient thingy that let you can pass instant message to next request<br>
  # it is consumed as soon as next request arrives
  class Flash
    def initialize session
      # NOTE no need to convert hash type because Session uses ParamHash for json parsing
      @now = session.delete('flash.next') || ParamHash.new
      session['flash.next'] = @next = ParamHash.new
    end
    attr_reader :now, :next

    def [] key
      @now[key]
    end

    def []= key, value
      @next[key] = value
    end

    def clear
      @now.clear
      @next.clear
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nyara-0.0.1.pre.8 lib/nyara/flash.rb