class Tennpipes::AuthenticityToken
Public Class Methods
new(app, options = {})
click to toggle source
Calls superclass method
# File lib/tennpipes-base/application/authenticity_token.rb, line 3 def initialize(app, options = {}) @app = app @except = options[:except] @except = Array(@except) unless @except.is_a?(Proc) super end
Public Instance Methods
call(env)
click to toggle source
Calls superclass method
# File lib/tennpipes-base/application/authenticity_token.rb, line 10 def call(env) if except?(env) @app.call(env) else super end end
except?(env)
click to toggle source
# File lib/tennpipes-base/application/authenticity_token.rb, line 18 def except?(env) return false unless @except path_info = env['PATH_INFO'] @except.is_a?(Proc) ? @except.call(env) : @except.any?{|path| path.is_a?(Regexp) ? path.match(path_info) : path == path_info } end