Magic Wiggly Lines => GuessMethod, by Chris Shea
If you ever make time to code just for pleasure, then method_missing and const_missing are just begging for abuse.
Chris Shea has come up with GuessMethod - a very cool hack that now deprecates my concept of Magic Wiggly Lines - a spell-checker for runtime code.
What’s it do? Cop a squiz at this genius…
$ gem install guessmethod -y $ irb > require 'rubygems' > require 'guessmethod' > class Object; include GuessMethod; end # though this could go in the guessmethod.rb file in the gem > class Product; def name; "Some product"; end; end > Prodct.nw.nae attention: replacing non-existant constant Prodct with Product for Object attention: sending new instead of nw to Product:Class attention: sending name instead of nae to #<Product:0×144ff10>:Product => “Some product”
That’s going straight into my .irbrc file. My bad spelling, coupled with my British/Australian English, will never slow me down again!
UPDATE: actually, it doesn’t like being in the .irbrc file for Rails console; so in the config/environments/development.rb files will have to do for the moment.
Meta-Magic in Ruby: Dr Nic Unplugged in Stockholm
Last nights’ Ruby meeting in Stockholm had a great turn out and starred Ola Bini sharing the latest and greatest about JRuby, and myself giving an overview on the wonders of Meta-Magic in Ruby.
I’ll write a separate post on Ola’s presentation shortly. It was awesome and I videoed it. Hehehe.
Meta-magic in a programming language is as important to programmers as changeable ring tones are to teenagers. Authors of programming languages cannot provide every feature to everyone, so it is so wonderful to be able to add new language features and extensions that you want. Everyone knows you can add Jessica Simpson as your mobile ring tone, but not all programmers know that you can add new features to their programming world.
So here is an overview to a new world of happiness. It also overviews how the Magic Models work, and introduces a new gem I’m working on - the Magic Wiggly Lines - described as “genius or insane”
