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.



13
14
15
# File 'lib/redirectly/app.rb', line 13

def initialize(config_path)
  @config_path = config_path
end

Instance Attribute Details

#config_pathObject (readonly)

Returns the value of attribute config_path.



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

def config_path
  @config_path
end

#reqObject (readonly)

Returns the value of attribute req.



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

def req
  @req
end

Instance Method Details

#call(env) ⇒ Object



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

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

  if found
    handle_target found
  else
    not_found
  end
end