Class: MixRack
- Inherits:
-
Object
- Object
- MixRack
- Defined in:
- lib/rack/mix-rack.rb
Constant Summary collapse
- COMPILER =
MixCompiler.new
Class Method Summary collapse
Class Method Details
.call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rack/mix-rack.rb', line 14 def MixRack.call (env) file_path = File.("./#{env["PATH_INFO"]}.mix", @@root) js_output_string = COMPILER.compile_to_string(file_path) if File.exists?(file_path) return 200, {"Content-Type" => "application/javascript"}, [js_output_string] else return 404, {"Content-Type" => "text/plain"}, [] end end |
.root_dir=(dir) ⇒ Object
10 11 12 |
# File 'lib/rack/mix-rack.rb', line 10 def MixRack.root_dir= (dir) @@root = dir end |