Class: SpamProtect::Policies::CookiePolicy

Inherits:
BasePolicy
  • Object
show all
Defined in:
lib/spam_protect/policies/cookie_policy.rb

Instance Method Summary collapse

Methods inherited from BasePolicy

#invalid?

Constructor Details

#initialize(cookie) ⇒ CookiePolicy



6
7
8
# File 'lib/spam_protect/policies/cookie_policy.rb', line 6

def initialize(cookie)
  @cookie = cookie
end

Instance Method Details

#valid?Boolean



10
11
12
13
14
15
16
17
# File 'lib/spam_protect/policies/cookie_policy.rb', line 10

def valid?
  unless SpamProtect.config.require_js
    return true
  end

  # Decryption/validity is checked elsewhere
  @cookie.to_s.strip.present?
end