summaryrefslogtreecommitdiff
path: root/doc/strscan/methods/getch.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/strscan/methods/getch.md')
-rw-r--r--doc/strscan/methods/getch.md9
1 files changed, 3 insertions, 6 deletions
diff --git a/doc/strscan/methods/getch.md b/doc/strscan/methods/getch.md
index b57732ad7c..ede1d2b071 100644
--- a/doc/strscan/methods/getch.md
+++ b/doc/strscan/methods/getch.md
@@ -1,6 +1,3 @@
-call-seq:
- getch -> character or nil
-
Returns the next (possibly multibyte) character,
if available:
@@ -12,7 +9,7 @@ if available:
- Increments the [byte position][2]
by the size (in bytes) of the character.
- ```
+ ```rb
scanner = StringScanner.new(HIRAGANA_TEXT)
scanner.string # => "こんにちは"
[scanner.getch, scanner.pos, scanner.charpos] # => ["こ", 3, 1]
@@ -27,7 +24,7 @@ if available:
(that is, not at its beginning),
behaves like #get_byte (returns a 1-byte character):
- ```
+ ```rb
scanner.pos = 1
[scanner.getch, scanner.pos, scanner.charpos] # => ["\x81", 2, 2]
[scanner.getch, scanner.pos, scanner.charpos] # => ["\x93", 3, 1]
@@ -37,7 +34,7 @@ if available:
- If the [position][2] is at the end of the [stored string][1],
returns `nil` and does not modify the positions:
- ```
+ ```rb
scanner.terminate
[scanner.getch, scanner.pos, scanner.charpos] # => [nil, 15, 5]
```