mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
20 lines
274 B
Ruby
20 lines
274 B
Ruby
|
# $Id$
|
||
|
|
||
|
require 'ripper/filter'
|
||
|
|
||
|
class CommentStripper < Ripper::Filter
|
||
|
def CommentStripper.strip(src)
|
||
|
new(src).parse(nil)
|
||
|
end
|
||
|
|
||
|
def on_default(event, token, data)
|
||
|
print token
|
||
|
end
|
||
|
|
||
|
def on_comment(token, data)
|
||
|
puts
|
||
|
end
|
||
|
end
|
||
|
|
||
|
CommentStripper.strip(ARGF)
|