I'm new to Ruby and am trying to code an elegant method for setting the working directory for the program. All file accesses with be relative to this path.

The program may or may not be run from within a Git repo. I also want to provide a method of overriding the path. 

I'm using OptionParser and am having difficulty getting it to set the option correctly. It seems that `work_area` always gets set to the Git toplevel, regardless of whether or not I'm using the `--work_area` flag. I've tried using a `||` operator within the `opts.on` and that didn't work either.

```
options = {}
OptionParser.new do |opts|
  opts.banner =  "Usage: mysprogram.rb [options]"

  options[:work_area] = `git rev-parse --show-toplevel --quiet 2>/dev/null`
  opts.on("-d", "--work_area", String, "Override default work area.") do |wa|
    options[:work_area] = wa
  end
  if options[:work_area]
    puts "Work area is " + options[:work_area]
  else
    puts "ERROR: Valid work directory not found or specified."
    puts opts
    exit
  end

  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
end.parse!

```

Any suggestions on what I'm doing wrong, or how to make this more Ruby-like, would be appreciated.