Class: Rack::Logs::Viewer
- Inherits:
-
Object
- Object
- Rack::Logs::Viewer
- Defined in:
- lib/rack/logs/viewer.rb
Defined Under Namespace
Classes: JoinedFiles
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(config) ⇒ Viewer
constructor
A new instance of Viewer.
Constructor Details
#initialize(config) ⇒ Viewer
Returns a new instance of Viewer.
5 6 7 |
# File 'lib/rack/logs/viewer.rb', line 5 def initialize config @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/rack/logs/viewer.rb', line 8 def config @config end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/rack/logs/viewer.rb', line 10 def call env contents = joined_logs(env.fetch('PATH_INFO','/')) if contents.empty? [404, headers, ['No Such File']] else [200, headers, contents] end end |