![]() CORE Methods Over 400 methods in the Atomic Methods collection! |
![]() MORE Modules More than 60 classes, modules and microframewords. |
Facets/CORE is a vast collection of core extension methods. Of particular uniquiness to the library is the atomicity the library, which is why it's called the Atomic Library. Essentially each extension method can be required independent of any other. This allows for very fine-grain control of desired features and interaction with other code resources. |
Facets/MORE is a collection of classes, modules and microframeworks which consitute an ever growing and improving source of reusable components. Some very nice additions are available, including an amazinglt complete SI units system and an elegant annotations systems, and all the more typical goodies like Tuple, Functor and Multiton. |
Perhaps you've come across that occasional need to assign a string that was more pictoral
in character
than textual. [ Pun intended :-) ] You've tried Ruby's various built string consturctors,
including those goovy HERE documents, you even tried letting the HERE text butt up against column
zero. Ick! In the end you either had line after line of str << "...."
, counted "\n"s
or said, "Heck wit it!". And loaded from a file. Well, no longer! Nano contains a great little
String method called #margin. It works like this:
x = %Q{ | This | is | margin controlled! }.margin
Of course you can use HERE documents if you prefer.
x = <<-HERE.margin | This | is | margin controlled! HERE
If you dislike the particular deliminator '|', or actually need to start lines with that character, then just pick another.
x = %Q{ This - is - margin controlled too! }.margin
The trick? It uses the first non-whitespace character on the 2nd line(tm). Clever, eh?
But wait. There's more! #margin also takes a parameter, with which you can specify the number of extra spaces to insert in place of the deliminator. So even if you need to push some ascii art text over 30 characters, there's no need for all that whitespace. Just specify the number.
Hope you've enjoyed this Spotlight. Now you too can produce nice and readable margin controlled strings in your code too with ease!
The general philosophy of Facets can be summed up in a simple mantra, "ALL BASE COMMON". The notion is that by sharing a large common foundation, that foundation can better serve us. There are a number of advantages to this approach. Among them name consistency, better code-reuse, collaborative improvements, one-stop shop and installation.
If you have any questions or suggestion feel free to contact Thomas Sawyer <transfire AT gmail DOT com>. Contributions are alwasy welcome!
Facets is not the sole achievement of one person, but was made possible by the hard work of many good programmers.
Daniel J. Berger Paul Brannan Mikael Brockman Jamis Buck Renald Buter Shashank Date Florian Frank Hal Fulton Michael Granger Florian Gross Thomas-Ivo Heinen Ara T. Howard David H. H. Mohammad Khan Gavin Kistner Derek Lewis Jan Molic George Moschovitis Michael Neumann Jonas Pfenniger Thomas Sawyer :) Daniel Schierbeck Gavin Sinclair Tilo Sloboda Peter Vanbroekhoven Jim Weirich Jeff Wood Austin Ziegler Why The Lucky Stiff
If I've missed anyone please toss me a bone! Great waves of thanks to all persons who made Facets possible.
Ruby Facets, Copyright (c) 2005 Thomas Sawyer
Ruby Facets is provided under the Ruby License.
Credit and Copyrights for particular borrowed code segments are given in their respective source. All licenses are either compatible with the Ruby license (Ruby or GPL) or the original author has given permission for inclusion of their code under this license.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.