- ARCHIVE / Ruby
- With a little help from with
You know the old saying:
with (JavaScript) {
metaprogramming.is(’possible’);
}
I’m going to leave the discussion of what constitutes metaprogramming to another day (read: never), but what I will say is that I’m becoming more interested in DSLs and fluent interfaces. I want the code I write to work at a very high level, where [...] - Let’s get committed
Right, I know I said I’d do this a long time ago, but I just got round to checking up on some of my Rails patches with the hopes of persuading one or two of you that they might be worth supporting and getting committed to the core. This post concerns a couple of patches [...]
- Deriving the Y combinator
Before I start in on this: be aware I’m mostly writing this to force myself to understand something by writing it down. If you get anything out of it, consider it a bonus. I will be deriving Y() in JavaScrpit, and giving a version in Ruby.
After stumbling on this article on Raganwald last year (thoroughly [...] - Announcing Holly
After some discussion at work about how to manage JavaScript dependencies in our CMS, I decided to write a quick Rails plugin for doing just that. It’s called Holly, and it lets you use special comments inside script and CSS files to declare their dependencies. Whenever you use javascript_include_tag or stylesheet_link_tag, Holly inspects the dependencies [...]
- JS.Class 1.0 hits the shelves
After much sweating, coding, and documentaion site-building, the 1.0 release of JS.Class is upon us. Thanks to the current edge version of PackR, I’ve managed to keep the filesize down but add boatloads of new features. I’ve tried to cram as much of the Ruby way into it as I can, with a pinch of [...]
- PackR won’t touch your $supers
Another quick update: PackR received an update today that means that when you use its :shrink_vars mode, it won’t minify any variables called $super. In Prototype, $super is used to implement inheritance and your class definitions will break if you change its name.
I didn’t really want to make PackR inconsistent with Dean’s original, but without [...] - PackR gem now available
Update: the gem seems to be up on RubyForge now, so just gem install packr and you’re all set.
At the request of Aman Gupta (again!) PackR is now available as a gem. I’ve not got myself all set up on RubyForge yet, but in the meantime you can download the gem from my subversion repository. [...] - PackR, now with class methods
Quick note: at the suggestion of Aman Gupta, PackR now supports Packr.pack, Packr.minify and Packr.pack_file as class methods, so you don’t need to create an instance of PackR before doing anything. Originally, I wanted PackR’s design to mirror the JavaScript version to make maintainance easier, but these methods are a tiny addition so I’m happy [...]
- JS.Class updates
Yes, it only came out a couple days ago, but it’s a 0.9.x release, so it’s still being developed. If you downloaded JS.Class over the last couple days, I strongly recommend you upgrade to the latest version.
First off, it improves performance substantially over the initial release by inspecting method definitions to find out if they [...] - Announcement: JS.Class
After mentioning Prototype’s inheritance model the other day, one rather important thing struck me about it. I was going to borrow their model for some of my own work when I realised that, if you use Prototype’s $super feature, your code will break if you compress it using a variable-shrinking algorithm (all the decent compressors [...]