From: Robert Klemme Date: 2008-11-19T23:30:25+09:00 Subject: Re: Idiomatic status check 2008/11/19 The One : > Hi, > > how would idiomatic Ruby look like when it comes to status checks of > processes? Here's a short method which checks if a PostgreSQL cluster is > up: > > def running? > output = `/etc/init.d/postgresql-8.3 status`.split > output[3] == "up" ? true : false > end > > What's the preferred way? Why not just def running? `/etc/init.d/postgresql-8.3 status`.split[3] == "up" end or even def running? /\bup\b/ =~ `/etc/init.d/postgresql-8.3 status` end ? Kind regards robert -- remember.guy do |as, often| as.you_can - without end