[11:15am] jchris: i really would like a way to inspect objects to see what methods they have defined.
[11:15am] jchris: i think i'm spoiled by ruby
[11:17am] sam-: Object.methods = function(object) {var methods = []; for (slot in object) if (typeof object[slot] == 'function') methods.push(slot); return methods}
[11:18am] sam-: call like Object.methods(someObject)
[11:19am] jchris: thanks. I'll try it
[11:20am] jchris: awesome! all the methods just popped out.
prototypejavascriptHAPPPPPYYYYYY NEW YEAR, peeps!
Ok,
I've been sparing you all the details of my hot love for
Ruby on Rails, but my
Other Blog is down for maintence (I can't post to it right now, but you can read it) so you'll have to bear with me and my excitement.
If you find yourself spending to much time in irb staring at things like this:
"annotation"=>"Youll Be Mine", "position"=>"3", "created_at"=>"2005-12-11 16:59:11"}>, #
nil, "artist"=>nil, "playlist_id"=>"1", "updated_at"=>"2005-12-11 16:59:12", "info_url"=>nil, "title"=>nil, "id"=>"5", "track_id"=>"5", "annotation"=>"You And I", "position"=>"4", "created_at"=>"2005-12-11 16:59:11"}>, #nil, "artist"=>nil, "playlist_id"=>"1", "updated_at"=>"2005-12-11 16:59:12", "info_url"=>nil, "title"=>nil, "id"=>"6", "track_id"=>"6", "annotation"=>"Johnny Wanna Live", "position"=>"5", "created_at"=>"2005-12-11 16:59:12"}>, #nil, "artist"=>nil, "playlist_id"=>"1", "updated_at"=>"2005-12-11 16:59:12", "info_url"=>nil, "title"=>nil, "id"=>"7", "track_id"=>"7", "annotation"=>"Innocent Love", "position"=>"6", "created_at"=>"2005-12-11 16:59:12"}>, #nil, "artist"=>nil, "playlist_id"=>"1", "updated_at"=>"2005-12-11 16:59:12", "info_url"=>nil, "title"=>nil, "id"=>"8", "track_id"=>"8", "annotation"=>"Celebrate Your Life", "position"=>"7", "created_at"=>"2005-12-11 16:59:12"}>, #nil, "artist"=>nil, "playlist_id"=>"1", "updated_at"=>"2005-12-11 16:59:12", "info_url"=>nil, "title"=>nil, "id"=>"9", "track_id"=>"9", "annotation"=>"Around My Heart", "position"=>"8", "created_at"=>"2005-12-11 16:59:12"}>, #nil, "artist"=>nil, "playlist_id"=>"1", "updated_at"=>"2005-12-11 16:59:13", "info_url"=>nil, "title"=>nil,
what you need is to open the terminal, type mate ~/.irbrc and paste the following in:
def py( thing = nil )
if thing.respond_to? 'to_yaml'
puts thing.to_yaml
else
puts thing
end
end
Now that you've done that, you can type "py my_object" and your object will get printed all pretty yaml style.
- !ruby/object:Track
attributes:
image_url:
artist:
playlist_id: "1"
updated_at: 2005-12-11 16:59:36
info_url:
title:
id: "84"
track_id: "84"
annotation: Alan Parsons Project
position: "83"
created_at: 2005-12-11 16:59:35
- !ruby/object:Track
attributes:
image_url:
artist:
playlist_id: "1"
updated_at: 2005-12-11 16:59:36
info_url:
title:
id: "85"
track_id: "85"
annotation: Sarah Brightman
position: "84"
created_at: 2005-12-11 16:59:36
thanks for the tips, ruby-breakpoint!
ruby
I spent the last two days at the offices of
Planet Argon, where I've been programming
Ruby on Rails. Rather, I've been using Ruby on Rails to write a website, with the help of a few other people, and getting paid for it. Considering that I'd be doing this anyway (and in not a stimulating context) even if I weren't getting paid, I can safely say I'm happy with my new job.
In the little world where the differences between various programming languages are important, Ruby (the language) is gaining stature and acceptance as fast as any language ever has. In the world most people live in, where programming languages are not that interesting, what it means is that not only do I have an opportunity to learn and challenge myself in a way that is satisfying, but also that the skills and experience I'm gaining should only get more valuable.
Hooray for doing what you like and getting paid! Or in geek speak - new job++