Skip to content

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

Notifications You must be signed in to change notification settings

alloy/MacOnRack

Repository files navigation

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.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published