Project

General

Profile

unexist.dev

/

subtle

Assorted tidbits and projects

Subtlext » History » Version 94

Anonymous, 01/21/2010 11:09 PM

1 94
h1. Subtlext\015\012\015\012[[Subtlext]] is an extension that brings the power of [[subtler]] to "Ruby":http://www.ruby-lang.org. \015\012\015\012A compending list of the classes with it's functionality can be found in "rdoc":http://unexist.scrapping.cc/rdoc/subtle/index.html and informations about the available unit tests in the [[development]] section.\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\012puts "subtle %s on %s" % \015\012  [Subtlext::VERSION, Subtlext::Subtle.running? ? \015\012  Subtlext::Subtle.display : "none"]\015\012\015\012puts "Tags: %s" % [Subtlext::Tag[:all].join(", ")]\015\012\015\012# Views\015\012views = []\015\012Subtlext::View[:all].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\012Subtlext::Client[:all].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.1684 on :0.0\015\012Tags: default, test, void, terms, browser, editor, stick, float, eight,\015\012  two, seven, one, bashrun, sakura, python\015\012Views: terms (terms, eight, two), [www] (browser, eight, two),\015\012  void (default, void, eight, two), editor (test, editor, seven, one)\015\012Clients: urxvt2 (two, one), urxvt1 (eight, seven),\015\012  subtle - Subtlext - Redmine - Vimperator (browser),\015\012  Xephyr on :2.0 (ctrl+shift grabs mouse and keyboard) (test, float),\015\012  event.c (~/projects/subtle/src/subtle) - GVIM (editor)\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":http://sinatra.rubyforge.org/ (*web.rb*) and an interface with "Ruby-Gtk":http://ruby-gnome2.sourceforge.jp (*gtk.rb*).\015\012\015\012{{tocnavi(subtle,Sublets,Quickstart,Grabs)}}