Time to upgrade to Ruby 1.9, but are you ready? Check out David Black's Ruby 1.9 Envycast for everything you need to know.

Sorry, no podcast this week because I'm at the Dynamic Languages World Conference, where yesterday I managed to sit in on a Groovy Tutorial. Groovy, in case you're not aware, is "an agile and dynamic language for the Java Virtual Machine which builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk".

I'm not writing this article to portray Ruby in a negative light, I love Ruby. However, there were a few scoops of syntactic sugar which were contained in groovy which I thought were worth sharing.

Working with hashes (Maps) - 5 - Information, Details and

Working with hashes (Maps) - 5 - Information, Details and

1
2
3
4
5
6
def name = ["first_name":"Gregg", "last_name":"Pollack"]
println name["first_name"]
>> Gregg

name.first_name
>> Gregg

Sugar: You can automatically access the hash keys as attributes just using .
Sugar: Some people might say that using : is simpler then =>
Sugar: Think about this as respect to mock objects, instead of:

1
2
3
user = mock('User')
user.stub!(:save).and_return true 
user.stub!(:destroy).and_return false

you could have


user = ["save":true, "destroy":false]

that's hawt

Closures
1
2
3
def say_hello = { println "hello" }
say_hello()
>> "hello"

To do the same thing in Ruby:

1
2
say_hello = lambda { puts "hello" }
say_hello.call

Sugar: Kinda nice that you don't have to use lambda in Groovy.
Sugar: You also don't have to use ".call", you just use ().

1
2
[1,2,3].each { print it }
>> 123

Sugar: In a closure, if you don't specify a parameter name, "it" is used. As opposed to Ruby:

1
2
[1,2,3].each { |it| print it }
>> 123

Why do we have to specify the name of the parameter? It'd be nice to have a default like "it".

Working with arrays
1
2
["gregg", "pollack"]*.toUpperCase()
>> ["GREGG", "POLLACK"]

Sugar: They have an operator for invoking methods on each item, the equivalent in Ruby:

1
2
["Gregg", "Pollack"].collect(&:upcase)
>> ["GREGG", "POLLACK"]

Just as good, but it's kinda neat they have an operator for that.

Fetching attributes of arrays
1
2
3
4
5
6
7
name1 = ["first_name":"Gregg", "last_name":"Pollack"]
name2 = ["first_name":"Jason", "last_name":"Seifer"]

names = [name1, name2]

names.first_name
>> ["Gregg", "Jason"]

Sugar: Check that out, if you call for an attribute on an array, it will look for those attributes on the objects inside the array. This got me thinking, what happens if you call for an attribute that doesn't exist.

1
2
names.middle_name
>> [null, null]

hah... rad.. no error, just doesn't have that property. This could be sweat for an array of different types of objects. Now in Ruby:

1
2
3
4
5
6
7
name1 = {:first_name => "Gregg", :last_name => "Pollack"}
name2 = {:first_name => "Jason", :last_name => "Seifer"}

names = [name1, name2]

names.collect {|name| name[:first_name] }
>> ["Gregg", "Jason"]

Hmm... I wonder if we can shorten that

1
2
names.collect(&:first_name)
>> NoMethodError: undefined method `first_name' for {:last_name=>"Pollack", :first_name=>"Gregg"}:Hash

Nope.. that's right, we don't want to call the method, we want to look up the value based on the key. Darn.

They can define the ++

Sugar: I know there's some good reason why we can define all the normal operators (ex. +, -) but not ++. Groovy can define ++, and I'm kinda jealous. I miss ++.

Vlogging and Railsconf

I stole my wife’s Flip Video for this trip, so I decided to try my hand at doing some Video Blogging. I’ll be trying to post an update every day for the next crazy week here in Germany, and then back at Railsconf.

This first video isn’t very educational, FYI, but over the next few days as Steven and I run into Speakers we’ll be getting many interviews where we ask “Give us your talk in 30 seconds”.

If you want to catch all the videos feel free to subscribe to my Vimeo RSS Feed.

If you’re coming to Railsconf please do say hi. Here’s what I’ll be doing:

  • Friday, 4:25 PM - 5:15 PM - Podcasting & Screencasting in Rails Panel, I’ll be talking with a few other Podcasters about how they put together their media.

  • Friday, 7:40 PM - 8:00 PM - Ruby Hero Awards Ceremony Before DHH’s keynote we’ll be giving out awards to people in our community who deserve some recognition.

  • Friday, 7:59 PM - We will premiere FOUR NEW RAILS ENVY VIDEOS before each keynote starting with DHHs. This time around we invited Five Runs Developer Adam Keys to join us in the madness.

  • Friday, 9:00 PM - 10:00 PM - Podcast Meetup If you can’t make our talk earlier in the day, have additional questions from the talk, or just want to meet other people who are passionate about Podcasting, come out to our birds of a feather.

The videos we show at Railsconf will be posted here on the blog on Tuesday

AddThis Social Bookmark Button Tags: Groovy Railsconf Ruby ruby  | permalink

Episode 032. Why bother reading RSS feeds when you can just listen to the podcast to get your fill of the most interesting Ruby and Rails news? This week staring Steven Bristol, Elvis Presley, and Fergie. Does it get any better then that?

If you're going to be at Railsconf next week, don't forget about the Ruby Heroes Award Ceremony, taking place Friday, 7:40 PM right before DHH's Keynote. Also if you're as passionate about podcasting as we are, come join us at the Podcast Meetup after DHH's keynote at 9 PM.

The Rails Envy podcast is sponsored this week by Engine Yard, fully managed hosting for your Rails applications. Learn more at EngineYard.com

Icon Speaker

Subscribe via iTunes - iTunes only link.
Download the podcast ~15:00 mins MP3.
Subscribe to feed via RSS by copying the link to your RSS Reader

In this episode:


  • Passenger on Dreamhost

  • Rails on Rubinius

  • Railscasts Rails Tips Contest

  • Load Balancing & QoS with HAProxy

  • Thor's Hammer

  • Palmist

  • Merb Unity

  • Merb Exceptions

  • Can Has Auth

  • The Narcissism of Small Code Differences

  • FiveRuns Manage 2.05

  • Dynamically Created Methods in Ruby

  • Javascript auto include rails plugin

  • Oracle Enhanced Adapter

  • Living on the Edge

AddThis Social Bookmark Button Sections: Podcast | Tags: podcast  | Meta: 2 comments | permalink

Episode 031. Steven Bristol is back this week and although the podcast is full of music, we don't actually sing. Seriously, I have no idea how all that music got in there.

The Rails Envy podcast is sponsored this week by Engine Yard, fully managed hosting for your Rails applications. Learn more at EngineYard.com

Icon Speaker

Subscribe via iTunes - iTunes only link.
Download the podcast ~18:00 mins MP3.
Subscribe to feed via RSS by copying the link to your RSS Reader


In this episode:


  • JRuby Rack

  • DBSlayer with ActiveRecord Adapter

  • WS-Deathstar SOAP walkthrough

  • Business Natural Languages Video

  • Rails iui plugin

  • Cross Site Reference Forgery

  • MonkeyBars

  • Endless Page Plugin

  • Ruby Hoedown

  • Ruby Kaigi

  • Reading a GPS with Ruby

  • Heroku Gets 3 Million

  • Notes from Advanced Rails Studio

  • Poor Mans CDN

  • Community Engine

  • Living on the Edge

AddThis Social Bookmark Button Sections: Podcast | Tags: podcast  | Meta: 7 comments | permalink

Episode 030. Steven Bristol steps in for Jason this week for this information packed episode. Last week some of our stories got screwed up by the microphone we were using, so this week we're back with extra ruby flavor.

The Rails Envy podcast is sponsored this week by Sun Microsystems, bringing you a complete open source develop-to-deploy environment for Ruby and Ruby on Rails. Learn more at Sun's Ruby Development Center at developers.sun.com/ruby

Icon Speaker

Subscribe via iTunes - iTunes only link.
Download the podcast ~22:00 mins MP3.
Subscribe to feed via RSS by copying the link to your RSS Reader

In this episode:


  • Rails Docs & Rails 2.1 Imminent

  • Capistrano 2.3.0

  • Webistrano 1.3

  • Metric Fu

  • Wikipedia API Ruby Wrapper

  • Elastic Server On Demand from Cohesive FT

  • Relic RPM by New Relic

  • RailsMachine new website

  • Rails Kits

  • Lovd By Less

  • Block Level Helpers in Rails

  • TextMate Syntax Highlighting

  • Hobofields plugin

  • Newbish Ruby on Rails Link Library

  • Building a Social Network Site in Rails

  • Extracting EXIF Data

  • GitHub RubyGems

  • A Look at Ruby Debuggers

  • Twitter isn't ditching Rails

  • Can Rails Scale? Absolutely!

  • Living on the Edge

AddThis Social Bookmark Button Sections: Podcast | Tags: podcast  | permalink