📁 File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-23 01:07:10
📂
/ (Root)
/
opt
/
alt
/
ruby33
/
share
/
ri
/
system
/
SyntaxSuggest
/
CaptureCodeContext
📍 /opt/alt/ruby33/share/ri/system/SyntaxSuggest/CaptureCodeContext
🔄 Refresh
✏️
Editing: cdesc-CaptureCodeContext.ri
Read Only
U:RDoc::NormalClass[iI"CaptureCodeContext:ETI"&SyntaxSuggest::CaptureCodeContext;TI"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"3Turns a "invalid block(s)" into useful context;To:RDoc::Markup::BlankLine o; ;[I"2There are three main phases in the algorithm:;T@o:RDoc::Markup::List: @type:NUMBER:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"!Sanitize/format input source;To;;0;[o; ;[I"Search for invalid blocks;To;;0;[o; ;[I"4Format invalid blocks into something meaningful;T@o; ;[I"'This class handles the third part.;T@o; ;[ I"=The algorithm is very good at capturing all of a syntax ;TI">error in a single block in number 2, however the results ;TI"Bcan contain ambiguities. Humans are good at pattern matching ;TI"@and filtering and can mentally remove extraneous data, but ;TI"2they can't add extra data that's not present.;T@o; ;[I"DIn the case of known ambiguious cases, this class adds context ;TI"Bback to the ambiguity so the programmer has full information.;T@o; ;[I"EBeyond handling these ambiguities, it also captures surrounding ;TI"code context information:;T@o:RDoc::Markup::Verbatim;[I"%puts block.to_s # => "def bark" ;TI" ;TI"'context = CaptureCodeContext.new( ;TI" blocks: block, ;TI" code_lines: code_lines ;TI") ;TI" ;TI"*lines = context.call.map(&:original) ;TI"puts lines.join ;TI" # => ;TI" class Dog ;TI" def bark ;TI" end;T:@format0: @fileI"/lib/syntax_suggest/capture_code_context.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[ I"code_lines;TI"R;T:privateFI"/lib/syntax_suggest/capture_code_context.rb;T[ [ [[I" class;T[[:public[ [:protected[ [;[[I"new;T@L[I" instance;T[[;[ [;[ [;[[I" call;T@L[I"capture_before_after_kws;T@L[I"capture_falling_indent;T@L[I"%capture_first_kw_end_same_indent;T@L[I"!capture_last_end_same_indent;T@L[I"sorted_lines;T@L[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[I"/lib/syntax_suggest/capture_code_context.rb;TI"SyntaxSuggest;TcRDoc::NormalModule
💾 Save Changes
❌ Cancel