Class: Grenweb::Searcher

Inherits:
Object
  • Object
show all
Includes:
Rack::Utils
Defined in:
lib/grenweb/searcher.rb

Instance Method Summary collapse

Constructor Details

#initializeSearcher

Returns a new instance of Searcher.



17
18
# File 'lib/grenweb/searcher.rb', line 17

def initialize
end

Instance Method Details

#call(env) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/grenweb/searcher.rb', line 20

def call(env)
  @request = Rack::Request.new(env)
  @query = Query.new(@request)

  @response = Rack::Response.new
  @response["Content-Type"] = "text/html; charset=UTF-8"

  @nth = 3                  # マッチした行の前後何行を表示するか

  if @request.post? or @request['query']
    post_request
  else
    search
  end
end