Class: Redirectly::App

Inherits:
Object
  • Object
show all
Defined in:
lib/redirectly/app.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_path) ⇒ App

Returns a new instance of App.



11
12
13
# File 'lib/redirectly/app.rb', line 11

def initialize(config_path)
  @config_path = config_path
end

Instance Attribute Details

#config_pathObject (readonly)

Returns the value of attribute config_path.



9
10
11
# File 'lib/redirectly/app.rb', line 9

def config_path
  @config_path
end

#reqObject (readonly)

Returns the value of attribute req.



9
10
11
# File 'lib/redirectly/app.rb', line 9

def req
  @req
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/redirectly/app.rb', line 15

def call(env)
  @req = Rack::Request.new env
  found = match

  if found
    redirect_to found
  else
    not_found
  end
end