Class: Lissio::Server::SourceMap
- Inherits:
-
Object
- Object
- Lissio::Server::SourceMap
- Defined in:
- lib/lissio/server.rb
Instance Attribute Summary collapse
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(sprockets) ⇒ SourceMap
constructor
A new instance of SourceMap.
Constructor Details
#initialize(sprockets) ⇒ SourceMap
Returns a new instance of SourceMap.
18 19 20 21 |
# File 'lib/lissio/server.rb', line 18 def initialize(sprockets) @sprockets = sprockets @prefix = '/__opal_source_maps__' end |
Instance Attribute Details
#prefix ⇒ Object
Returns the value of attribute prefix.
16 17 18 |
# File 'lib/lissio/server.rb', line 16 def prefix @prefix end |
Instance Method Details
#call(env) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/lissio/server.rb', line 23 def call(env) if asset = @sprockets[env['PATH_INFO'].gsub(/^\/|\.js\.map$/, '')] [200, { "Content-Type" => "text/json" }, [$OPAL_SOURCE_MAPS[asset.pathname].to_s]] else [404, {}, []] end end |