Sha256: c9701ee0997d066700bd80af52e97023dd107f364810533a66c913a357ab9177

Contents?: true

Size: 558 Bytes

Versions: 6991

Compression:

Stored size: 558 Bytes

Contents

module CodeRay
module Encoders
  
  # Returns the number of tokens.
  # 
  # Text and block tokens are counted.
  class Count < Encoder
    
    register_for :count
    
  protected
    
    def setup options
      super
      
      @count = 0
    end
    
    def finish options
      output @count
    end
    
  public
    
    def text_token text, kind
      @count += 1
    end
    
    def begin_group kind
      @count += 1
    end
    alias end_group begin_group
    alias begin_line begin_group
    alias end_line begin_group
    
  end
  
end
end

Version data entries

6,991 entries across 6,978 versions & 75 rubygems

Version Path
passbase-1.3.0 vendor/bundle/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/coderay-1.1.2/lib/coderay/encoders/count.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/coderay-1.1.2/lib/coderay/encoders/count.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/coderay-1.1.2/lib/coderay/encoders/count.rb
logstash-output-scalyr-0.1.9 vendor/bundle/jruby/2.5.0/gems/coderay-1.1.2/lib/coderay/encoders/count.rb
logstash-output-scalyr-0.1.8 vendor/bundle/jruby/2.5.0/gems/coderay-1.1.2/lib/coderay/encoders/count.rb
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/gems/coderay-1.1.2/lib/coderay/encoders/count.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
logstash-output-scalyr-0.1.6 vendor/bundle/jruby/2.5.0/gems/coderay-1.1.2/lib/coderay/encoders/count.rb
mfk_openapi_ruby_client-1.0.0 vendor/bundle/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
logstash-output-newrelic-1.2.0 vendor/bundle/jruby/2.5.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
qiita_org-0.1.35 gems/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
qiita_org-0.1.34 gems/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
qiita_org-0.1.33 gems/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
qiita_org-0.1.32 gems/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
qiita_org-0.1.31 gems/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
qiita_org-0.1.30 gems/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb
qiita_org-0.1.29 gems/ruby/2.7.0/gems/coderay-1.1.3/lib/coderay/encoders/count.rb