Class: MSpec::Opal::Index

Inherits:
Object show all
Defined in:
opal/lib/mspec/opal/rake_task.rb

Constant Summary

HTML =
<<-HTML
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Opal Specs</title>
  </head>
  <body>
    <script src="/mspec/opal/main.js"></script>
  </body>
</html>
HTML

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Index

Returns a new instance of Index



243
244
245
# File 'opal/lib/mspec/opal/rake_task.rb', line 243

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



247
248
249
250
251
252
253
# File 'opal/lib/mspec/opal/rake_task.rb', line 247

def call(env)
  if %w[/ /index.html].include? env['PATH_INFO']
    [200, { 'Content-Type' => 'text/html' }, [HTML]]
  else
    @app.call env
  end
end