Sha256: c9701ee0997d066700bd80af52e97023dd107f364810533a66c913a357ab9177

Contents?: true

Size: 558 Bytes

Versions: 6944

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,944 entries across 6,932 versions & 73 rubygems

Version Path
lazy_record-0.1.4 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
tdiary-5.0.4 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
logstash-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
lazy_record-0.1.3 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
lazy_record-0.1.2 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
lazy_record-0.1.1 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
lazy_record-0.1.0 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
logstash-input-fifo-0.9.1 vendor/bundle/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
logstash-input-fifo-0.9.0 vendor/bundle/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
abaci-0.3.0 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
logstash-filter-delta-1.1.0 vendor/bundle/jruby/2.2.0/gems/coderay-1.1.1/lib/coderay/encoders/count.rb
logstash-filter-delta-1.0.1 vendor/bundle/jruby/2.2.0/gems/coderay-1.1.1/lib/coderay/encoders/count.rb