Sha256: 3c744c7396443810c4e4aba8423ff1e29202eb0edd5612b2a7d1dbd1ceddce7a

Contents?: true

Size: 541 Bytes

Versions: 11

Compression:

Stored size: 541 Bytes

Contents

require 'noumenon'

class Noumenon::Spec::ExampleApp
  def initialize(options = {})
    @options = { message: "This is a mounted application" }.merge(options.symbolize_keys)
  end
  
  def call(env)
    case env["PATH_INFO"]
      when "/"
        respond 200, "<h1>#{@options[:message]}</h1>"
      when "/sub"
        respond 200, "<h1>This is a sub-page</h1>"
      else
        respond 404, "Page Not Found"
    end
  end

  def respond(status, content)
    [ status, { "Content-Type" => "text/html" }, StringIO.new(content) ]
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
noumenon-0.2.2 lib/noumenon/spec/example_app.rb
noumenon-0.2.1 lib/noumenon/spec/example_app.rb
noumenon-0.2.0 lib/noumenon/spec/example_app.rb
noumenon-0.1.7 lib/noumenon/spec/example_app.rb
noumenon-0.1.6 lib/noumenon/spec/example_app.rb
noumenon-0.1.5 lib/noumenon/spec/example_app.rb
noumenon-0.1.4 lib/noumenon/spec/example_app.rb
noumenon-0.1.3 lib/noumenon/spec/example_app.rb
noumenon-0.1.2 lib/noumenon/spec/example_app.rb
noumenon-0.1.1 lib/noumenon/spec/example_app.rb
noumenon-0.1.0 lib/noumenon/spec/example_app.rb