Class: DefMastership::CommentFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/defmastership/comment_filter.rb

Overview

Kind of proxy that Filters comments fome Asciidoctor document

Instance Method Summary collapse

Constructor Details

#initializeCommentFilter

Returns a new instance of CommentFilter.



10
11
12
# File 'lib/defmastership/comment_filter.rb', line 10

def initialize
  @in_multiline_comment = false
end

Instance Method Details

#accept?(line) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
# File 'lib/defmastership/comment_filter.rb', line 14

def accept?(line)
  case line
  when DMRegexp::SINGLE_LINE_COMMENT then false
  when DMRegexp::MULTI_LINE_COMMENT_DELIM
    @in_multiline_comment ^= true
    false
  else !@in_multiline_comment
  end
end