D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
SyntaxSuggest
/
CleanDocument
/
Filename :
clean_sweep-i.ri
back
Copy
U:RDoc::AnyMethod[iI"clean_sweep:ETI"-SyntaxSuggest::CleanDocument#clean_sweep;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"Remove comments;To:RDoc::Markup::BlankLine o; ; [I" replace with empty newlines;T@o:RDoc::Markup::Verbatim; [I"source = <<~'EOM' ;TI" # Comment 1 ;TI" puts "hello" ;TI" # Comment 2 ;TI" puts "world" ;TI" EOM ;TI" ;TI"5lines = CleanDocument.new(source: source).lines ;TI"'expect(lines[0].to_s).to eq("\n") ;TI"0expect(lines[1].to_s).to eq("puts "hello") ;TI"'expect(lines[2].to_s).to eq("\n") ;TI"0expect(lines[3].to_s).to eq("puts "world") ;T:@format0o; ; [I"0Important: This must be done before lexing.;T@o; ; [I"<After this change is made, we lex the document because ;TI"8removing comments can change how the doc is parsed.;T@o; ; [I"For example:;T@o;; [ I"*values = LexAll.new(source: <<~EOM)) ;TI" User. ;TI" # comment ;TI"! where(name: 'schneems') ;TI" EOM ;TI" expect( ;TI"3 values.count {|v| v.type == :on_ignored_nl} ;TI").to eq(1) ;T; 0o; ; [I""After the comment is removed:;T@o;; [ I"+ values = LexAll.new(source: <<~EOM)) ;TI" User. ;TI" ;TI"" where(name: 'schneems') ;TI" EOM ;TI" expect( ;TI"3 values.count {|v| v.type == :on_ignored_nl} ;TI").to eq(2);T; 0: @fileI")lib/syntax_suggest/clean_document.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(source:);T@AFI"CleanDocument;TcRDoc::NormalClass00