Class: Authentication::Logic::Session::MagicColumn::AssignsLastRequestAt Private

Inherits:
Object
  • Object
show all
Defined in:
lib/auth/logic/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 ‘Authentication::Logic::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.



21
22
23
24
25
26
# File 'lib/auth/logic/session/magic_column/assigns_last_request_at.rb', line 21

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.



28
29
30
31
32
# File 'lib/auth/logic/session/magic_column/assigns_last_request_at.rb', line 28

def assign
  return unless assign?

  @record.last_request_at = @current_time
end