Ruby example

Ruby code posted by Alexey
created at 04 Oct 16:11, updated at 06 Oct 00:44

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
534 Bytes in 2 ms with coderay