count.rb
21 lines
| 230 B
| text/x-ruby
|
RubyLexer
|
r638 | module CodeRay | ||
module Encoders | ||||
class Count < Encoder | ||||
include Streamable | ||||
register_for :count | ||||
protected | ||||
def setup options | ||||
@out = 0 | ||||
end | ||||
def token text, kind | ||||
@out += 1 | ||||
end | ||||
end | ||||
end | ||||
end | ||||