Class: Seojs::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/seojs/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



7
8
9
# File 'lib/seojs/middleware.rb', line 7

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/seojs/middleware.rb', line 11

def call(env)
  @env = env

  if test?
    return [ 200, {"Content-Type" => "text/html"}, ['SEO.js Middleware Found!'] ]
  elsif Seojs.url && escaped_fragment_query?
    triplet = get_snapshot
    return triplet if triplet
  end
  @app.call(env)
end