AlkantarClanX12
Current Path : /proc/thread-self/root/opt/alt/ruby18/share/ri/1.8/system/StringScanner/ |
Current File : //proc/thread-self/root/opt/alt/ruby18/share/ri/1.8/system/StringScanner/cdesc-StringScanner.yaml |
--- !ruby/object:RI::ClassDescription attributes: [] class_methods: - !ruby/object:RI::MethodSummary name: must_C_version - !ruby/object:RI::MethodSummary name: new comment: - !ruby/struct:SM::Flow::P body: "StringScanner provides for lexical scanning operations on a String. Here is an example of its usage:" - !ruby/struct:SM::Flow::VERB body: " s = StringScanner.new('This is an example string')\n s.eos? # -> false\n\n p s.scan(/\\w+/) # -> "This"\n p s.scan(/\\w+/) # -> nil\n p s.scan(/\\s+/) # -> " "\n p s.scan(/\\s+/) # -> nil\n p s.scan(/\\w+/) # -> "is"\n s.eos? # -> false\n\n p s.scan(/\\s+/) # -> " "\n p s.scan(/\\w+/) # -> "an"\n p s.scan(/\\s+/) # -> " "\n p s.scan(/\\w+/) # -> "example"\n p s.scan(/\\s+/) # -> " "\n p s.scan(/\\w+/) # -> "string"\n s.eos? # -> true\n\n p s.scan(/\\s+/) # -> nil\n p s.scan(/\\w+/) # -> nil\n" - !ruby/struct:SM::Flow::P body: Scanning a string means remembering the position of a <em>scan pointer</em>, which is just an index. The point of scanning is to move forward a bit at a time, so matches are sought after the scan pointer; usually immediately after it. - !ruby/struct:SM::Flow::P body: "Given the string "test string", here are the pertinent scan pointer positions:" - !ruby/struct:SM::Flow::VERB body: " t e s t s t r i n g\n 0 1 2 ... 1\n 0\n" - !ruby/struct:SM::Flow::P body: "When you #scan for a pattern (a regular expression), the match must occur at the character after the scan pointer. If you use #scan_until, then the match can occur anywhere after the scan pointer. In both cases, the scan pointer moves <em>just beyond</em> the last character of the match, ready to scan again from the next character onwards. This is demonstrated by the example above." - !ruby/struct:SM::Flow::H level: 2 text: Method Categories - !ruby/struct:SM::Flow::P body: There are other methods besides the plain scanners. You can look ahead in the string without actually scanning. You can access the most recent match. You can modify the string being scanned, reset or terminate the scanner, find out or change the position of the scan pointer, skip ahead, and so on. - !ruby/struct:SM::Flow::H level: 3 text: Advancing the Scan Pointer - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#getch" - !ruby/struct:SM::Flow::LI label: "-" body: "#get_byte" - !ruby/struct:SM::Flow::LI label: "-" body: "#scan" - !ruby/struct:SM::Flow::LI label: "-" body: "#scan_until" - !ruby/struct:SM::Flow::LI label: "-" body: "#skip" - !ruby/struct:SM::Flow::LI label: "-" body: "#skip_until" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Looking Ahead - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#check" - !ruby/struct:SM::Flow::LI label: "-" body: "#check_until" - !ruby/struct:SM::Flow::LI label: "-" body: "#exist?" - !ruby/struct:SM::Flow::LI label: "-" body: "#match?" - !ruby/struct:SM::Flow::LI label: "-" body: "#peek" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Finding Where we Are - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#beginning_of_line? (#bol?)" - !ruby/struct:SM::Flow::LI label: "-" body: "#eos?" - !ruby/struct:SM::Flow::LI label: "-" body: "#rest?" - !ruby/struct:SM::Flow::LI label: "-" body: "#rest_size" - !ruby/struct:SM::Flow::LI label: "-" body: "#pos" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Setting Where we Are - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#reset" - !ruby/struct:SM::Flow::LI label: "-" body: "#terminate" - !ruby/struct:SM::Flow::LI label: "-" body: "#pos=" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Match Data - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "#matched" - !ruby/struct:SM::Flow::LI label: "-" body: "#matched?" - !ruby/struct:SM::Flow::LI label: "-" body: "#matched_size" - !ruby/struct:SM::Flow::LI label: "-" body: "[]" - !ruby/struct:SM::Flow::LI label: "-" body: "#pre_match" - !ruby/struct:SM::Flow::LI label: "-" body: "#post_match" type: :BULLET - !ruby/struct:SM::Flow::H level: 3 text: Miscellaneous - !ruby/object:SM::Flow::LIST contents: - !ruby/struct:SM::Flow::LI label: "-" body: "<<" - !ruby/struct:SM::Flow::LI label: "-" body: "#concat" - !ruby/struct:SM::Flow::LI label: "-" body: "#string" - !ruby/struct:SM::Flow::LI label: "-" body: "#string=" - !ruby/struct:SM::Flow::LI label: "-" body: "#unscan" type: :BULLET - !ruby/struct:SM::Flow::P body: There are aliases to several of the methods. constants: [] full_name: StringScanner includes: [] instance_methods: - !ruby/object:RI::MethodSummary name: "<<" - !ruby/object:RI::MethodSummary name: "[]" - !ruby/object:RI::MethodSummary name: beginning_of_line? - !ruby/object:RI::MethodSummary name: check - !ruby/object:RI::MethodSummary name: check_until - !ruby/object:RI::MethodSummary name: clear - !ruby/object:RI::MethodSummary name: concat - !ruby/object:RI::MethodSummary name: empty? - !ruby/object:RI::MethodSummary name: eos? - !ruby/object:RI::MethodSummary name: exist? - !ruby/object:RI::MethodSummary name: get_byte - !ruby/object:RI::MethodSummary name: getbyte - !ruby/object:RI::MethodSummary name: getch - !ruby/object:RI::MethodSummary name: initialize_copy - !ruby/object:RI::MethodSummary name: inspect - !ruby/object:RI::MethodSummary name: match? - !ruby/object:RI::MethodSummary name: matched - !ruby/object:RI::MethodSummary name: matched? - !ruby/object:RI::MethodSummary name: matched_size - !ruby/object:RI::MethodSummary name: matchedsize - !ruby/object:RI::MethodSummary name: peek - !ruby/object:RI::MethodSummary name: peep - !ruby/object:RI::MethodSummary name: pointer - !ruby/object:RI::MethodSummary name: pointer= - !ruby/object:RI::MethodSummary name: pos - !ruby/object:RI::MethodSummary name: pos= - !ruby/object:RI::MethodSummary name: post_match - !ruby/object:RI::MethodSummary name: pre_match - !ruby/object:RI::MethodSummary name: reset - !ruby/object:RI::MethodSummary name: rest - !ruby/object:RI::MethodSummary name: rest? - !ruby/object:RI::MethodSummary name: rest_size - !ruby/object:RI::MethodSummary name: restsize - !ruby/object:RI::MethodSummary name: scan - !ruby/object:RI::MethodSummary name: scan_full - !ruby/object:RI::MethodSummary name: scan_until - !ruby/object:RI::MethodSummary name: search_full - !ruby/object:RI::MethodSummary name: skip - !ruby/object:RI::MethodSummary name: skip_until - !ruby/object:RI::MethodSummary name: string - !ruby/object:RI::MethodSummary name: string= - !ruby/object:RI::MethodSummary name: terminate - !ruby/object:RI::MethodSummary name: unscan name: StringScanner superclass: Object