Class: Lissio::Server::SourceMap

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#prefixObject

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