Well geez, I could have done that ;P
And so can ruby!
$ cat ben.rb | ./one-line.rb > one.rb
$ ruby one.rb "dreamhost"
Ratio of sucks to rocks for dreamhost is 1:1.60663507109005
----------------------------------
#!/usr/bin/env ruby
puts $stdin.readlines.map{|l|
if l =~ /(.*)(#.*)/
t = $1
l = t if $2 !~ /\#\{.*\}/
end
c = l.chomp.strip
c == "" ? nil : c
}.compact.join(";")
---------------------------------
This doesn't work for anything too tricky (like one-line.rb itself...),
and I wouldn't be surprised if this has been done before and much more
thoroughly, but still, it works on Ben's script and mine.
Okay, I'll stop now (maybe).
--
Caleb Phillips
IT Specialist
Small White Cube
_______________________________________________
PDXRuby mailing list
[email protected]
IRC: #pdx.rb on irc.freenode.net
http://lists.pdxruby.org/mailman/listinfo/pdxruby