Module: ActionControllerTweaks::Session::OptionProcessor

Defined in:
lib/action_controller_tweaks/session.rb

Class Method Summary collapse

Class Method Details

.extract_expires_at(options) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/action_controller_tweaks/session.rb', line 27

def self.extract_expires_at(options)
  expires_at = options.delete(:expires_at) || options.delete(:expire_at)
  if expires_at && expires_at.respond_to?(:to_time)
    expires_at = expires_at.to_time
  end
  if expires_at && !expires_at.is_a?(Time)
    fail InvalidOptionValue.new(:expires_at, expires_at, Time)
  end
  expires_at
end

.extract_expires_in(options) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/action_controller_tweaks/session.rb', line 19

def self.extract_expires_in(options)
  expires_in = options.delete(:expires_in) || options.delete(:expire_in)
  if expires_in && !expires_in.is_a?(Numeric)
    fail InvalidOptionValue.new(:expires_in, expires_in, Numeric)
  end
  expires_in
end