Some fun with ruby
posted by simon on Thursday, December 14, 2006
class String def readBracketedList self.scan(/\[\[([^\]]+)\]\]|(\S+)/).map {|m| m[0]||m[1]} end endHa ha sweet ruby-ness! :) And it works:
p "[[Hello there]] this that [[other]] [[one more]]".readBracketedList ["Hello there", "this", "that", "other", "one more"]So now to get this blog a little more on topic... The above comes from a little project I started to fix up the code that assembles a TiddlyWiki site when you create it. The starting point is this stuff which I use to developing/release MPTW and MonkeyGTD. Hopefully this will turn into a nice set of ruby classes for manipulating TiddlyWiki files, (and maybe even a substitute for cook and ginsu) that I can release as open source and use in Tiddlyspot.
For this work I have installed Eclipse and RDT and I'm using unit testing (and svn if I ever get the subclipse plugin working). Anyway it's pretty cool so far though I am missing my vim.
Labels: ruby
0 Comments:
Post a Comment
<< Home