On Fri, 13 Oct 2000  23:12:44 +0900, Hal E. Fulton wrote:
> > > >
> > > > 1. a "literate mode" that assumes all lines in a script are comments
> > > > unless the first column is a special character (Haskell uses '>').
> > > >
[snip]
> 
> I can see where this might be of some value... but I *think* I might like
> some
> other way of distinguishing besides the file extension. Maybe a command line
> parameter? Or maybe something embedded at the top of the file? For scripts
> using #!, of course, they become almost the same.

quick hack, call this script something like `lruby':

------

#!/usr/bin/ruby -w

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

------

$ cat x
doc doc doc

> class Foo
>   def initialize
>     puts "foo!"
>   end
> end

doc doc doc

> Foo.new

doc doc doc

$ lruby x
foo!
$ _


	hope to help,
	Michel