Skip to content
Handling web interfaces with Ruby using the Atlas toolkit.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Atlas
Blank
Chatroom
Hello
Notes
TodoMVC
CHANGELOG.md
LICENSE
README.md

README.md

Ruby version of the Atlas toolkit

Ruby logo

A fast and easy way to add web interfaces to Ruby applications.

Hello, World!

Here's how a Hello, World! type application made with the Atlas toolkit looks like:

Little demonstration

  • git clone http://github.com/epeios-q37/atlas-ruby
  • cd atlas-ruby
  • php Hello/Hello.rb

For a live demonstration: http://q37.info/runkit/Hello.

Source code:

require 'Atlas'

$body =
<<~HEREDOC
<div style="display: table; margin: 50px auto auto auto;">
 <fieldset>
  <input id="input" maxlength="20" placeholder="Enter a name here" type="text"
         data-xdh-onevent="Submit" value="World"/>
  <div style="display: flex; justify-content: space-around; margin: 5px auto auto auto;">
   <button data-xdh-onevent="Submit">Submit</button>
   <button data-xdh-onevent="Clear">Clear</button>
  </div>
 </fieldset>
</div>
HEREDOC

def acConnect(userObject, dom, id)
 dom.setLayout("", $body)
 dom.focus("input")
end

def acSubmit(userObject, dom, id)
 dom.alert("Hello, " + dom.getContent("input") + "!")
 dom.focus("input")
end

def acClear(userObject, dom, id)
 if dom.confirm?("Are you sure?")
  dom.setContent("input", "")
 end
 dom.focus("input")
end

callbacks = {
 "" => method(:acConnect),  # This key is the action label for a new connection.
 "Submit" => method(:acSubmit),
 "Clear" => method(:acClear),
}

Atlas.launch(callbacks)

TodoMVC

And here's how the Atlas toolkit version of the TodoMVC application looks like:

TodoMVC

For a live demonstration: http://q37.info/runkit/TodoMVC.

Content of the repository

The Atlas directory contains the Ruby source code of the Atlas toolkit, which is not needed to run the examples.

All other directories are examples.

To run an example, launch ruby -IAtlas <Name>/main.rb, where <Name> is the name of the example (Blank, Chatroom…).

The Atlas toolkit is also available for:

For more information about the Atlas toolkit, go to http://atlastk.org/.

You can’t perform that action at this time.