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>
    <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



218
219
220
# File 'opal/lib/mspec/opal/rake_task.rb', line 218

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



222
223
224
225
226
227
228
# File 'opal/lib/mspec/opal/rake_task.rb', line 222

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