Class: Panthro

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

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.disable_logsObject

Returns the value of attribute disable_logs.



5
6
7
# File 'lib/panthro.rb', line 5

def disable_logs
  @disable_logs
end

.mirrorObject

Returns the value of attribute mirror.



5
6
7
# File 'lib/panthro.rb', line 5

def mirror
  @mirror
end

.pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/panthro.rb', line 5

def path
  @path
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/panthro.rb', line 8

def call env
  @env          = env
  @file_path    = "#{ self.class.path }#{ env['PATH_INFO'] }"
  @path         = @env['PATH_INFO']
  @method       = @env['REQUEST_METHOD']

  return get_from_mirror if (@path == '/' or @path =~ /\/info/)
  return get_from_cache if File.exist? @file_path
  get_from_mirror
end