Kiss A simpler, smarter web application framework for Ruby

Kiss::Login Subclass of Hash

Public Class Methods

new(session) source

Not documented

    # File lib/kiss/login.rb, line 3
    def initialize(session)
      @session = session
      @session['login'] ||= {}
      
      # check if login expired
      if expired?
        # login expired
        @session['login'] = {}
      end
      
      @persist_data = @session['login']
      self.merge!(@persist_data)
    end
    

Public Instance Methods

clear() source

Not documented

    # File lib/kiss/login.rb, line 40
    def clear
      @session['login'] = {}
      super()
    end
    
expired?() source

Not documented

    # File lib/kiss/login.rb, line 17
    def expired?
      @session['login']['expires_at'] && session['login']['expires_at'] < Time.now
    end
    
expires_at(time) source

Not documented

    # File lib/kiss/login.rb, line 26
    def expires_at(time)
      persist(:expires_at => time)
    end
    
expires_at=(seconds) source

Not documented

    # File lib/kiss/login.rb, line 29
    def expires_at=(seconds)
      expires_at(seconds)
    end
    
expires_in(seconds) source

Not documented

    # File lib/kiss/login.rb, line 33
    def expires_in(seconds)
      persist(:expires_at => Time.now + seconds)
    end
    
expires_in=(seconds) source

Not documented

    # File lib/kiss/login.rb, line 36
    def expires_in=(seconds)
      expires_in(seconds)
    end
    
persist(data = {}) source

Not documented

    # File lib/kiss/login.rb, line 21
    def persist(data = {})
      @persist_data.merge!(data)
      self.merge!(data)
    end
    

Disabled; run with $DEBUG to generate this.