#!/usr/bin/ruby -w
# Literate ruby. Every line not starting with MARK is documentation, lines
# marked with MARK are code.

MARK = ">"

script = File.open(ARGV.shift).readlines
script.each{ |line|
  if line !~ /^#{MARK}/
    line.sub!(/^/, "# ")      # comment out documentation
  else
    line.sub!(/^#{MARK}/, "") # unmark code
  end
}

eval script.to_s              # run it
