Sha256: fb6eb5a32c32c01eeb3f7a3e6559c70ff458d83d3f95a5d9a23f8dd77ad41b7e

Contents?: true

Size: 771 Bytes

Versions: 20

Compression:

Stored size: 771 Bytes

Contents

#--
#            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#                    Version 2, December 2004
#
#            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
#  0. You just DO WHAT THE FUCK YOU WANT TO.
#++

class ${ClassName}
  helpers do
    def set_cookie(key, value, path = '/', expires = nil)
      response.set_cookie key, {
        :value   => value,
        :path    => path,
        :expires => expires || Time.now + 24 * 60 * 60
      }
    end

    def get_cookie(key)
      request.cookies[key]
    end

    def cookie_exists?(key)
      !!get_cookie(key)
    end

    def delete_cookie(key)
      set_cookie key, '', '/', Time.now
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
gennaro-0.3.6.5 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.6.4 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.6.3 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.6.2 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.6.1 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.6 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.5 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.4.2 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.4.1 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.4 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.3 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.2.3 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.2.2 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.2.1 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.2 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.1.3 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.1.2 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.1.1 templates/authentication/app/helpers/cookie.rb
gennaro-0.3.1 templates/authentication/app/helpers/cookie.rb
gennaro-0.3 templates/authentication/app/helpers/cookie.rb