Now let’s un-hardcode that string in the puts by adding a parameter.
Great. We have a default String. But what about something more complex. What if we want a hash of options. Say we have a little piece of an IRC client.
Now when we use it like this, we can connect to a default server or override it.
`
>> connect
Connecting to irc.freenode.net ...
connect({:server => “irc.efnet.net”})
Connecting to irc.efnet.net …
`
Now a more complicated example. All we’re doing here is loading defaults from a YAML file and doing the same thing as before.
Go ahead and give it a try and play with it. It's a good recipe with many uses.