Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A sample MacRuby application demonstrating how to connect Rack to a WebView.

branch: master
README.markdown

MacOnRack Demo

A sample MacRuby application demonstrating how to connect Rack to a WebView.

require 'rack_url_protocol'

class ApplicationController
  attr_accessor :webView

  def awakeFromNib
    # Register your custom scheme.
    # This should be unique to your app.
    RackURLProtocol.register("rack", withRackApplication: self)

    # Load the root "/" page
    webView.mainFrameURL = "rack:///"
  end

  def call(env)
    [200, {"Content-Type" => "text/html"}, ["<h1>Hello, MacRuby!</h1>"]]
  end
end

Try it with Sinatra or any other rack application that runs on MacRuby.

See RackURLProtocol sstephenson/rack_url_protocol for the latest adapter.

Something went wrong with that request. Please try again.