Class: Erb::Comment::CommentCompiler

Inherits:
ERB::Compiler
  • Object
show all
Defined in:
lib/erb/comment.rb

Instance Method Summary collapse

Constructor Details

#initializeCommentCompiler

Returns a new instance of CommentCompiler.



18
19
20
21
# File 'lib/erb/comment.rb', line 18

def initialize(*)
  super
  @in_comment = false
end

Instance Method Details

#compile_etag(etag, _, scanner) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/erb/comment.rb', line 33

def compile_etag(etag, _, scanner)
  case etag
  when '--#>'
    scanner.stag = nil
    @in_comment = false
  else
    super unless @in_comment
  end
end

#compile_stag(stag, _, scanner) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/erb/comment.rb', line 23

def compile_stag(stag, _, scanner)
  case stag
  when '<#--'
    scanner.stag = stag
    @in_comment = true
  else
    super
  end
end

#make_scanner(src) ⇒ Object



43
44
45
# File 'lib/erb/comment.rb', line 43

def make_scanner(src)
  CommentScanner.new(src, @trim_mode, @percent)
end