Class: Rack::MusicIndex
- Inherits:
-
Object
- Object
- Rack::MusicIndex
- Defined in:
- lib/rack/musicindex.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
- #init(options) ⇒ Object
-
#initialize(app, options = {}) ⇒ MusicIndex
constructor
A new instance of MusicIndex.
Constructor Details
#initialize(app, options = {}) ⇒ MusicIndex
Returns a new instance of MusicIndex.
7 8 9 10 11 |
# File 'lib/rack/musicindex.rb', line 7 def initialize(app, = {}) @app = app init() end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rack/musicindex.rb', line 17 def call(env) path_info = env['PATH_INFO'] # to compare with static_path which is utf-8 encoding path_info.force_encoding('UTF-8') if path_info.respond_to? :force_encoding update_files if dirs[path_info] serve_podcast(env) elsif static_paths.include?(unescape(path_info)) serve_mp3(env) else status, headers, response = @app.call(env) end end |
#init(options) ⇒ Object
13 14 15 |
# File 'lib/rack/musicindex.rb', line 13 def init() @dirs = end |