The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
The community responds

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Adam Green

Posts: 102
Nickname: darwinian
Registered: Dec, 2005

Adam Green is the author of Ruby.Darwinianweb.com
The community responds Posted: Dec 29, 2005 12:17 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Adam Green.
Original Post: The community responds
Feed Title: ruby.darwinianweb.com
Feed URL: http://www.nemesis-one.com/rss.xml
Feed Description: Adam Green's Ruby development site
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Adam Green
Latest Posts From ruby.darwinianweb.com

Advertisement
I knew that my coding style would strike people as un-Rubylike. I code like the dBASE programmer I have been for 25 years. What I didn't know is how they would respond. So far I've received 4 emails on my getparam.rb program, and all of them have been helpful and polite. What a relief. I've worked in some tough language neighborhoods in the past. The worst was in the late Eighties when the Clipper faction of the dBASE community felt that the only way they could distinguish themselves as "real programmers" was to attack the rest of us as stupid and lazy.

The responses ranged from alternative ways of parsing the .yml file to suggestions for using the built-in Yaml library. I had looked at this library, but couldn't find any docs on getting started. One respondent sent me a link for docs as well. Here is the simplest version using YAML.rb:

get_param.rb

 #! /usr/bin/ruby



require 'yaml'



def get_param( param_file, key)
options = YAML.load_file( param_file )
options[key]
end
One part of Ruby style I still find hard to adjust to is the lack of a return statement. I know it isn't needed since the last value will be returned anyway, but I still find myself looking for it when reading code. This exercise is about becoming a Ruby programmer, however, so I'll try to adapt.

Read: The community responds

Topic: More about naming conventions Previous Topic   Next Topic Topic: Merry Christmas. Ruby 1.8.4 Released

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use