Assorted tidbits and projects

Subtlext » History » Version 86

Anonymous, 09/03/2009 11:52 PM

1 86
h1. Subtlext\015\012\015\012[[Subtlext]] is an extension that brings the power of [[subtler]] to "Ruby": A complete list of the stuff that is possible with [[subtlext]] can be found "here": or generated with @rake rdoc@. Unit tests for [[Subtlext|sublext]] are also included. [[Development|Read more about unit tests]]\015\012\015\012h2. Examples\015\012\015\012This time a more complex example to show what you can do with this extension:\015\012\015\012<pre><code class="ruby">\015\012require("subtle/subtlext")\015\012\015\012subtle =":2")\015\012\015\012puts "subtle %s on %s" % \015\012  [subtle.version, subtle.running? ? subtle.display : "none"]\015\012\015\012puts "Tags: %s" % [subtle.tags.join(", ")]\015\012\015\012# Views\015\012views = []\015\012subtle.views.each do |v|\015\012  views.push("%s (%s)" % [v.current? ? "[#{v}]" : v, v.tags.join(", ")])\015\012end\015\012puts "Views: %s" % [views.join(", ")]\015\012\015\012# Clients\015\012clients = []\015\012subtle.clients.each do |c|\015\012  clients.push("%s (%s)" % [c, c.tags.join(", ")])\015\012end\015\012puts "Clients: %s" % [clients.join(", ")]\015\012</code></pre>\015\012\015\012Output:\015\012<pre><code>subtle 0.8.1017 on :2.0\015\012Tags: default, float, full, editor, video, browser, terms\015\012Views: web (default, browser), [dev] (editor, terms), work (video, browser, terms)\015\012Clients: xterm (terms), xterm (terms)\015\012</code></pre>\015\012\015\012More examples are in the tarball in *dist/scripts*. Currently there is the example from above (*example.rb*), an example for a web interface with "Sinatra": (*web.rb*) and an interface with "Ruby-Gtk": (*gtk.rb*).\015\012\015\012[[Subtlext#1|top]]