Message-ID: <540310077.25131.1394273070324.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_25130_374918625.1394273070323" ------=_Part_25130_374918625.1394273070323 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Boo.Lang.Useful - an assembly rife with things beautiful and use= ful yet not quite core to the Boo language. Welcome to this introductory gu= ide, where we will plumb its murky depths in search of adventure on the hig= h seas and delicious pirate treasures.
Boo.Lang.Useful is meant for user contributions to Boo in Boo - sometime= s you have a really good idea for a great addition to Boo, but it just isn'= t "core" for the language. Enter, Boo.Lang.Useful: an assembly ba= sed primarily of user contributions for stuff that is extremely helpful but= not quite core. If you want to contribute, please go to JIRA= and open a new issue in the "Boo.Lang.Useful" component, and= attach a patch for your component. Please follow the Coding Conventions page for submissions.
Here are some of the out-standing features already available ...
This class is used as a quick and dirty to enumerate through the lines i= n a text file as if it were any other object that implemented the IEnumerab= le interface. It is useful for quickly grokking information in newline-deli= mited (\n, or \r\n) formats. It is also useful for editing a file's content= s with a short, sweet, and simple API.
The static methods ReadFile() and WriteFile() are used to respectively r= ead the entire contents of a file to a string, and write the contents of a = string to a file.
eachFile accepts two parameters: a string containing a directory that wi= ll act as root, and a function that will be executed for each file in the r= oot directory and all of the root directory's subdirectories. This function= is recursive.
listFiles returns an enumerable object, a list of strings that represent= filenames in the root directory and every subdirectory specified by the pa= rameter. It is a recursive function.
walk returns an enumerable object consisting of three elements: the curr= ent directory, an array of strings representing subdirectories within the c= urrent directory, and an array of strings representing files within the cur= rent directory. It is a recursive function.
The Singleton attribute automates the implementation of the Singleton de= sign pattern. Attaching this attribute to a structure or a class generates = code to protect all constructors and and implements a single property, 'Ins= tance,' that points to an instance of your class.
If you want to initalize certain objects, create a parameter-less constr= uctor (this will be made protected and will be called by the Singleton attr= ibute).
For more information about the singleton design pattern, check out thi= s article.
Applied to a method, the Once attribute will automatically cache the val=
ue returned by the method on it's first call. Following calls to the method=
will simply re-use the cached value. This is usefull for methods that do l=
ong and / or expensive processing since the processing will be done only 'O=
A Set class for the math freaks. (stub, fill in later)