rubychan/coderay

View on GitHub
lib/coderay/encoders/comment_filter.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module CodeRay
module Encoders
  
  load :token_kind_filter
  
  # A simple Filter that removes all tokens of the :comment kind.
  # 
  # Alias: +remove_comments+
  # 
  # Usage:
  #  CodeRay.scan('print # foo', :ruby).comment_filter.text
  #  #-> "print "
  # 
  # See also: TokenKindFilter, LinesOfCode
  class CommentFilter < TokenKindFilter
    
    register_for :comment_filter
    
    DEFAULT_OPTIONS = superclass::DEFAULT_OPTIONS.merge \
      :exclude => [:comment, :docstring]
    
  end
  
end
end