Class: Authlogic::Session::MagicColumn::AssignsLastRequestAt Private

Inherits:
Object
  • Object
show all
Defined in:
lib/authlogic/session/magic_column/assigns_last_request_at.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Assigns the current time to the ‘last_request_at` attribute.

  1. The ‘last_request_at` column must exist

  2. Assignment can be disabled on a per-controller basis

  3. Assignment will not happen more often than ‘last_request_at_threshold`

seconds.
  • current_time - a ‘Time`

  • record - eg. a ‘User`

  • controller - an ‘Authlogic::ControllerAdapters::AbstractAdapter`

  • last_request_at_threshold - integer - seconds

Instance Method Summary collapse

Constructor Details

#initialize(current_time, record, controller, last_request_at_threshold) ⇒ AssignsLastRequestAt

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of AssignsLastRequestAt.



20
21
22
23
24
25
# File 'lib/authlogic/session/magic_column/assigns_last_request_at.rb', line 20

def initialize(current_time, record, controller, last_request_at_threshold)
  @current_time = current_time
  @record = record
  @controller = controller
  @last_request_at_threshold = last_request_at_threshold
end

Instance Method Details

#assignObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
30
# File 'lib/authlogic/session/magic_column/assigns_last_request_at.rb', line 27

def assign
  return unless assign?
  @record.last_request_at = @current_time
end