Sha256: 6967be63818074f1ecf27252a59c8b9253f17e2a6338ebf2922616f74b959cdd

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

require "highway/version"
require "highway/array"
require "highway/routing"

module Highway
  class Application
    def call(env)
      if env['PATH_INFO'] == '/favicon.ico'
        return [404,
                {'Content-Type' => 'text/html'}, []]
      end

      if env['PATH_INFO'] == '/'
        return [404,
                {'Content-Type' => 'text/html'}, 'home']
      end

      klass, act = get_controller_and_action(env)
      controller = klass.new(env)
      text = controller.send(act)
      [200, {'Content-Type' => 'text/html'},
       [text]]
    end
  end

  class Controller
    def initialize(env)
      @env = env
    end

    def env
      @env
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
highways-0.0.2 lib/highway.rb