From: Robert Klemme Date: 2008-09-23T21:45:00+09:00 Subject: Re: Shortcut for "if options.key?(:full)" ? 2008/9/23 Peter Alvin : > If I pass an options hash into a def, how do I easily check to see if an > option is set? This is how I'm doing it now: > > if options.key?(:some_option) > ... > end > > Knowing Ruby, there's got to be a cleaner/better way! If nil is not used as valid option value you can usually do if options[:some_option] I don't see how it can become much shorter - unless you rename "options" and options. Cheers robert -- use.inject do |as, often| as.you_can - without end