種類
ライブラリ
- ビルトイン (16643)
-
shell
/ command-processor (12)
クラス
-
ARGF
. class (218) - Array (1155)
- BasicObject (168)
- Bignum (99)
- Binding (86)
- Class (64)
- Complex (129)
- Data (21)
- Dir (150)
- Encoding (516)
-
Encoding
:: Converter (120) -
Encoding
:: InvalidByteSequenceError (84) - Enumerator (151)
-
Enumerator
:: ArithmeticSequence (21) -
Enumerator
:: Chain (14) -
Enumerator
:: Lazy (199) -
Enumerator
:: Yielder (24) - Exception (64)
- FalseClass (24)
- Fiber (66)
- File (418)
-
File
:: Stat (276) - Fixnum (84)
- Float (152)
- FrozenError (6)
- Hash (879)
- IO (640)
- Integer (277)
- KeyError (16)
- LocalJumpError (24)
- MatchData (94)
- Method (200)
- Module (748)
- Mutex (8)
- NameError (32)
- NilClass (36)
- NoMethodError (21)
- Numeric (187)
- Object (1111)
-
ObjectSpace
:: WeakMap (24) - Proc (80)
-
Process
:: Status (72) - Random (43)
- Range (307)
- Rational (48)
- Regexp (141)
- RubyVM (37)
-
RubyVM
:: AbstractSyntaxTree :: Node (49) -
RubyVM
:: InstructionSequence (246) - Set (36)
-
Shell
:: CommandProcessor (12) - SignalException (24)
- StopIteration (12)
- String (1047)
- Struct (209)
- Symbol (419)
- SystemCallError (12)
- SystemExit (12)
- Thread (411)
-
Thread
:: Backtrace :: Location (84) -
Thread
:: ConditionVariable (40) -
Thread
:: Mutex (40) -
Thread
:: Queue (58) -
Thread
:: SizedQueue (68) - ThreadGroup (12)
- Time (168)
- TracePoint (181)
- TrueClass (36)
- UnboundMethod (179)
- UncaughtThrowError (22)
モジュール
- Comparable (87)
- Enumerable (1424)
-
File
:: Constants (48) - FileTest (294)
- GC (98)
-
GC
:: Profiler (36) - Kernel (768)
- Marshal (48)
- Math (36)
- ObjectSpace (120)
- Process (96)
-
Process
:: GID (36) -
Process
:: Sys (12) -
Process
:: UID (36) -
RubyVM
:: AbstractSyntaxTree (30) -
RubyVM
:: MJIT (21) - Warning (6)
キーワード
- ! (12)
- != (12)
- !~ (12)
-
$ -K (5) -
$ -a (12) -
$ -d (12) -
$ -l (12) -
$ -p (12) -
$ -v (12) -
$ -w (12) -
$ = (12) -
$ > (12) -
$ DEBUG (12) -
$ KCODE (5) -
$ SAFE (5) -
$ VERBOSE (12) -
$ stderr (12) -
$ stdin (12) -
$ stdout (12) - % (18)
- & (18)
- * (6)
- ** (17)
- + (30)
- - (6)
- -@ (3)
-
/ (6) - < (73)
- << (78)
- <= (73)
- <=> (27)
- == (259)
- === (110)
- =~ (21)
- > (73)
- >= (73)
- >> (32)
- ARGF (12)
- ARGV (12)
-
ASCII
_ 8BIT (12) - AbstractSyntaxTree (7)
- BIG5 (12)
-
BIG5
_ HKSCS (12) -
BIG5
_ HKSCS _ 2008 (12) -
BIG5
_ UAO (12) - BINARY (24)
- BasicObject (12)
- Big5 (12)
-
Big5
_ HKSCS (12) -
Big5
_ HKSCS _ 2008 (12) -
Big5
_ UAO (12) - Bignum (9)
- Binding (12)
-
CLOCK
_ BOOTTIME (12) -
CLOCK
_ BOOTTIME _ ALARM (12) -
CLOCK
_ MONOTONIC (12) -
CLOCK
_ PROCESS _ CPUTIME _ ID (12) -
CLOCK
_ REALTIME (12) - CP951 (12)
- Comparable (12)
- CompatibilityError (12)
- Complex (24)
- ConditionVariable (20)
- DATA (12)
- DEBUG (12)
- DEBUG= (12)
-
DEFAULT
_ PARAMS (12) - E2BIG (12)
- EBADE (12)
- EBADF (12)
- EBADFD (12)
- EBADMSG (12)
- EBADR (12)
- EBADRPC (12)
- EBADRQC (12)
- EBADSLT (12)
-
EBCDIC
_ CP _ US (10) - EBFONT (12)
- EBUSY (12)
- EFBIG (12)
- ELIBACC (12)
- ELIBBAD (12)
- ELIBEXEC (12)
- ELIBMAX (12)
- ELIBSCN (12)
- ENOBUFS (12)
- ENOTBLK (12)
- ENOTCAPABLE (11)
- ENOTRECOVERABLE (12)
- ENV (12)
- ETXTBSY (12)
- EWOULDBLOCK (12)
- Enumerable (12)
- FALSE (8)
-
FNM
_ EXTGLOB (12) - Fiber (12)
- FiberError (12)
- GB12345 (12)
- GB18030 (12)
- GB1988 (12)
- GBK (12)
- Hash (12)
- IBM037 (10)
- IBM437 (12)
- IBM720 (4)
- IBM737 (12)
- IBM775 (12)
- IBM850 (12)
- IBM852 (12)
- IBM855 (12)
- IBM857 (12)
- IBM860 (12)
- IBM861 (12)
- IBM862 (12)
- IBM863 (12)
- IBM864 (12)
- IBM865 (12)
- IBM866 (12)
- IBM869 (12)
-
INSTRUCTION
_ NAMES (12) -
INTERNAL
_ CONSTANTS (12) - InstructionSequence (12)
- Integer (12)
- InvalidByteSequenceError (12)
-
LOCK
_ NB (12) - Location (12)
- MJIT (7)
- Method (12)
- NIL (8)
- NONBLOCK (12)
- Node (7)
- OPTS (12)
- Object (12)
- ObjectSpace (12)
- Proc (12)
-
RLIMIT
_ SBSIZE (12) -
RUBY
_ COPYRIGHT (12) -
RUBY
_ DESCRIPTION (12) -
RUBY
_ ENGINE (12) -
RUBY
_ ENGINE _ VERSION (10) -
RUBY
_ PATCHLEVEL (12) -
RUBY
_ PLATFORM (12) -
RUBY
_ RELEASE _ DATE (12) -
RUBY
_ REVISION (12) -
RUBY
_ VERSION (12) - RubyVM (12)
-
SCRIPT
_ LINES _ _ (12) -
SJIS
_ SOFTBANK (12) -
SJIS
_ SoftBank (12) - STDERR (12)
- STDIN (12)
- STDOUT (12)
- String (12)
- Symbol (12)
-
TOPLEVEL
_ BINDING (12) - TRUE (8)
-
UCS
_ 2BE (12) -
UCS
_ 4BE (12) -
UTF8
_ SOFTBANK (12) -
UTF8
_ SoftBank (12) -
UTF
_ 16BE (12) -
UTF
_ 32BE (12) - UnboundMethod (12)
- WaitReadable (12)
- WaitWritable (12)
- WeakMap (12)
- [] (297)
- []= (72)
- ^ (42)
-
_ _ callee _ _ (12) -
_ _ id _ _ (12) -
_ _ method _ _ (12) -
_ _ send _ _ (24) -
_ dump (12) -
_ id2ref (12) - abort (48)
-
abort
_ on _ exception (24) -
abort
_ on _ exception= (24) - abs (63)
- abs2 (24)
-
absolute
_ path (36) -
absolute
_ path? (6) -
add
_ trace _ func (12) -
alias
_ method (4) - alive? (16)
- all? (53)
-
all
_ symbols (12) - allbits? (8)
- allocate (12)
- any? (62)
- anybits? (8)
- append (8)
-
append
_ as _ bytes (1) - args (12)
- arity (24)
-
ascii
_ compatible? (12) -
ascii
_ only? (12) - assoc (12)
- at (12)
- attr (12)
-
attr
_ accessor (4) -
attr
_ reader (4) -
attr
_ writer (4) -
auto
_ compact (4) -
auto
_ compact= (4) - autoclose= (12)
- autoclose? (12)
- backtrace (24)
-
backtrace
_ locations (36) -
base
_ label (24) - basename (12)
- begin (31)
- between? (24)
- bind (12)
-
bind
_ call (12) - binding (36)
- binmode (24)
- binmode? (24)
- binread (12)
- binwrite (12)
- birthtime (34)
-
bit
_ length (18) - blksize (12)
-
block
_ given? (12) - blockdev? (36)
- blocks (12)
- broadcast (10)
- bsearch (48)
-
bsearch
_ index (20) - bytebegin (2)
- byteend (2)
- byteindex (3)
- byteoffset (6)
- byterindex (3)
- bytes (71)
- bytesize (12)
- byteslice (36)
- bytesplice (10)
- call (24)
-
callee
_ id (12) -
caller
_ locations (24) - capitalize (12)
- casecmp (12)
- casecmp? (18)
- casefold? (12)
- catch (24)
- cbrt (12)
- chain (7)
- chardev? (36)
- chars (12)
- chdir (24)
- children (7)
- chunk (12)
-
chunk
_ while (21) - clamp (27)
- class (12)
-
class
_ eval (24) -
class
_ exec (12) -
class
_ variable _ defined? (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) -
class
_ variables (12) - clone (36)
-
close
_ on _ exec= (12) -
close
_ on _ exec? (12) - closed? (34)
- codepoints (12)
- collect (36)
-
collect
_ concat (36) - combination (24)
- compact (13)
- compact! (9)
-
compare
_ by _ identity (12) -
compare
_ by _ identity? (12) - compatible? (12)
- compile (12)
-
compile
_ file (12) -
compile
_ option (12) -
compile
_ option= (12) - concat (18)
-
const
_ defined? (12) -
const
_ get (12) -
const
_ set (12) -
const
_ source _ location (12) - constants (24)
- convert (12)
- coredump? (12)
- count (48)
-
count
_ objects (12) - cover? (19)
- current (4)
- curry (46)
- cycle (48)
- deconstruct (9)
-
def
_ builtin _ commands (6) - default (24)
- define (3)
-
define
_ finalizer (24) -
define
_ method (48) -
define
_ singleton _ method (24) - delete (48)
-
delete
_ at (12) - deq (20)
-
destination
_ encoding (12) -
destination
_ encoding _ name (12) - detect (24)
- dig (30)
- digits (12)
- directory? (36)
- disable (48)
- disasm (24)
- disassemble (24)
- disjoint? (3)
- display (12)
- div (6)
- divmod (3)
- downcase (12)
- drop (12)
-
drop
_ while (24) - dst? (12)
- dummy? (12)
- dump (36)
- dup (12)
- each (79)
-
each
_ byte (72) -
each
_ char (12) -
each
_ codepoint (12) -
each
_ cons (24) -
each
_ entry (24) -
each
_ grapheme _ cluster (8) -
each
_ key (24) -
each
_ object (48) -
each
_ pair (36) -
each
_ slice (24) -
each
_ value (24) -
each
_ with _ index (24) -
each
_ with _ object (24) - empty? (108)
- enable (48)
- enabled? (31)
- enclosed? (12)
- encode (36)
- encoding (12)
- end (12)
-
end
_ with? (18) - enq (10)
- entries (19)
-
enum
_ for (36) - eof (24)
- eof? (24)
- eql? (162)
- equal? (48)
-
error
_ bytes (12) - eval (48)
- even? (18)
- event (12)
- except (4)
-
exclude
_ end? (19) - exclusive (12)
- executable? (36)
-
executable
_ real? (36) - exist? (36)
- exists? (27)
-
exit
_ value (12) - exited? (12)
- extend (12)
-
extend
_ object (12) - extended (12)
- fail (12)
- fdiv (3)
- feed (12)
- fetch (80)
-
fetch
_ values (22) - file? (36)
- filter (49)
- filter! (28)
-
filter
_ map (12) - find (24)
-
find
_ all (24) -
find
_ index (36) - finish (12)
- finite? (30)
- first (60)
-
first
_ column (7) -
first
_ lineno (19) -
fixed
_ encoding? (12) -
flat
_ map (36) - fnmatch (12)
- fnmatch? (12)
-
for
_ fd (12) - force (12)
- format (12)
- freeze (12)
- friday? (12)
- frozen? (12)
-
garbage
_ collect (24) - getbyte (36)
- getc (12)
- gets (12)
- glob (24)
-
global
_ variables (12) - gmt? (12)
-
grapheme
_ clusters (8) - grep (24)
-
grep
_ v (24) -
group
_ by (24) - grpowned? (36)
- gsub (84)
- gsub! (48)
-
handle
_ interrupt (12) -
has
_ key? (24) -
has
_ value? (24) - hash (51)
- id2name (12)
- identical? (24)
-
ignore
_ deadlock (4) -
ignore
_ deadlock= (4) - include? (87)
-
incomplete
_ input? (12) - index (7)
- inherited (12)
- initialize (12)
-
initialize
_ clone (12) -
initialize
_ copy (12) -
initialize
_ dup (12) - inject (36)
- insert (12)
-
insert
_ output (12) - inspect (115)
-
install
_ builtin _ commands (6) -
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ method (12) -
instance
_ methods (12) -
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instance
_ variable _ set (12) -
instance
_ variables (12) -
instruction
_ sequence (7) - integer? (12)
- intern (24)
- intersect? (7)
- intersection (6)
- invert (12)
- irb (9)
-
is
_ a? (12) - isatty (12)
- isdst (12)
- issetugid (12)
- iterator? (12)
- itself (12)
- join (12)
-
keep
_ if (48) - key (20)
- key? (36)
- keys (24)
-
keyword
_ init? (4) -
kind
_ of? (12) - label (24)
- lambda (18)
- lambda? (12)
- last (36)
-
last
_ column (7) -
last
_ lineno (7) -
last
_ match (24) -
latest
_ gc _ info (12) - lazy (12)
- length (12)
- lineno (12)
- lineno= (24)
- load (12)
-
load
_ from _ binary (10) -
load
_ from _ binary _ extra _ data (10) -
local
_ variable _ defined? (12) -
local
_ variable _ get (12) -
local
_ variable _ set (12) -
local
_ variables (33) - locked? (12)
- log (24)
- loop (12)
- magnitude (63)
- map (36)
-
marshal
_ dump (12) -
marshal
_ load (12) - match (48)
- match? (27)
- max (130)
-
max
_ by (48) - member? (51)
- members (30)
- merge (24)
- merge! (24)
- method (12)
-
method
_ defined? (12) -
method
_ id (12) -
method
_ missing (12) - methods (12)
- min (130)
-
min
_ by (48) - minmax (48)
-
minmax
_ by (24) -
module
_ eval (24) -
module
_ exec (12) -
module
_ function (12) - modulo (6)
- monday? (12)
- name (53)
-
named
_ captures (12) - nan? (12)
- negative? (29)
- new (226)
- next (36)
- next! (12)
- nil? (24)
- nobits? (8)
- none? (53)
- nonzero? (12)
-
object
_ id (12) - oct (12)
- odd? (18)
- of (22)
- one? (53)
- open (84)
-
original
_ name (24) - overlap? (2)
- owned? (48)
- owner (12)
- p (12)
- pack (21)
- parameters (43)
- parse (10)
-
parse
_ file (10) - partition (24)
- path (24)
- pause (7)
- peek (12)
-
pending
_ interrupt? (24) - permutation (12)
- pipe (96)
- pipe? (36)
- pop (32)
- popen (84)
- pos= (12)
- positive? (29)
- pow (22)
- pp (8)
- pread (8)
- prepend (20)
-
prepend
_ features (12) -
primitive
_ convert (48) - printf (24)
- priority (12)
- priority= (12)
- private (53)
-
private
_ call? (9) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) -
private
_ methods (12) - proc (19)
-
proper
_ subset? (3) -
proper
_ superset? (3) - protected (12)
-
protected
_ instance _ methods (12) -
protected
_ method _ defined? (12) -
protected
_ methods (12) - public (75)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ instance _ methods (12) -
public
_ method (12) -
public
_ method _ defined? (12) -
public
_ methods (12) -
public
_ send (24) - push (22)
- putback (24)
- putc (36)
- puts (12)
- raise (42)
- rassoc (12)
-
re
_ exchangeable? (24) - read (12)
-
read
_ nonblock (24) - readable? (36)
-
readable
_ real? (36) -
readagain
_ bytes (12) - readbyte (24)
- readline (12)
- readlines (12)
- readpartial (24)
- real? (12)
- realdirpath (12)
- realpath (12)
- reason (12)
- receiver (47)
- reduce (36)
- regexp (12)
- rehash (12)
- reject (36)
- remainder (3)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
repeated
_ combination (24) - replace (12)
- replacement= (12)
-
report
_ on _ exception (18) -
report
_ on _ exception= (9) - require (12)
-
require
_ relative (12) -
resolve
_ feature _ path (1) -
respond
_ to? (12) -
respond
_ to _ missing? (12) - restore (12)
- result (12)
- resume (19)
-
return
_ value (12) -
reverse
_ each (48) - rewind (19)
- rotate (12)
- rotate! (12)
-
ruby2
_ keywords (18) -
ruby2
_ keywords _ hash? (6) - sample (24)
- saturday? (12)
- scan (24)
- scrub (36)
- scrub! (36)
- seek (12)
- select (84)
- select! (48)
- self (12)
- send (24)
-
set
_ backtrace (12) -
set
_ encoding (72) -
set
_ encoding _ by _ bom (6) -
set
_ trace _ func (12) - setbyte (12)
- setgid? (36)
- setuid? (36)
- shift (44)
-
sid
_ available? (24) - signal (10)
- signaled? (12)
-
singleton
_ class (12) -
singleton
_ class? (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) - size (15)
- slice (152)
- slice! (48)
-
slice
_ after (35) -
slice
_ before (60) -
slice
_ when (23) - socket? (36)
- sort (48)
- sort! (24)
-
sort
_ by (24) -
sort
_ by! (24) -
source
_ encoding (12) -
source
_ encoding _ name (12) -
source
_ location (19) - split (19)
- sprintf (12)
- srand (12)
-
start
_ with? (18) - stat (23)
- status (12)
- step (62)
- sticky? (36)
- stop (12)
- stop? (12)
- stopped? (12)
- store (12)
- stress (12)
- strftime (12)
- sub (60)
- sub! (36)
- subclasses (4)
- subsec (12)
- subset? (3)
- subtract (3)
- succ (27)
- succ! (12)
- success? (24)
- sum (54)
- sunday? (12)
-
super
_ method (11) - superset? (3)
- swapcase (12)
- switch (24)
- symlink? (24)
- sync (12)
- synchronize (12)
- sysread (12)
- system (48)
- tag (11)
- taint (9)
- tainted? (9)
- take (12)
-
take
_ while (48) - tally (10)
- tap (12)
- test (24)
- then (14)
-
thread
_ variable? (12) -
thread
_ variable _ get (12) -
thread
_ variable _ set (12) - thursday? (12)
-
to
_ a (55) -
to
_ ary (12) -
to
_ binary (10) -
to
_ enum (36) -
to
_ f (3) -
to
_ h (57) -
to
_ hash (12) -
to
_ i (12) -
to
_ int (12) -
to
_ io (12) -
to
_ proc (24) -
to
_ regexp (12) -
to
_ s (104) -
to
_ set (6) -
to
_ str (12) -
to
_ sym (24) -
to
_ tty? (8) - trace (12)
- transfer (4)
-
transform
_ keys (20) -
transform
_ keys! (20) -
transform
_ values (18) -
transform
_ values! (18) - trust (9)
-
try
_ convert (64) -
try
_ lock (12) - tty? (12)
- tuesday? (12)
- type (7)
- unbind (12)
-
undef
_ method (12) -
undefine
_ finalizer (12) - ungetbyte (12)
-
unicode
_ normalized? (11) - union (19)
- uniq (24)
- unpack (12)
- unpack1 (9)
- unshift (12)
- untaint (9)
-
untrace
_ var (12) - untrust (9)
- untrusted? (9)
- upcase (12)
- update (24)
- upto (12)
-
used
_ modules (12) - utc? (12)
-
valid
_ encoding? (12) - value (23)
- value? (24)
- values (24)
-
values
_ at (48) -
verify
_ compaction _ references (6) - wait (10)
- wednesday? (12)
-
with
_ index (36) -
with
_ object (24) -
world
_ readable? (36) -
world
_ writable? (36) - writable? (36)
-
writable
_ real? (36) -
write
_ nonblock (12) - yield (24)
-
yield
_ self (16) - zero? (63)
- zip (72)
- | (42)
- ~ (6)
検索結果
先頭5件
-
String
# [](regexp , nth = 0) -> String (8004.0) -
正規表現 regexp の nth 番目の括弧にマッチする最初の部分文字列を返します。 nth を省略したときや 0 の場合は正規表現がマッチした部分文字列全体を返します。 正規表現が self にマッチしなかった場合や nth に対応する括弧がないときは nil を返します。
...m regexp 取得したい文字列のパターンを示す正規表現
@param nth 取得したい正規表現レジスタのインデックス。整数
//emlist[例][ruby]{
p "foobar"[/bar/] # => "bar"
p $~.begin(0) # => 3
p "def getcnt(line)"[ /def\s+(\w+)/, 1 ] # => "getcnt"
//}... -
String
# slice(nth) -> String | nil (8004.0) -
nth 番目の文字を返します。 nth が負の場合は文字列の末尾から数えます。 つまり、 self.size + nth 番目の文字を返します。
...数
@return 指定した位置の文字を表す String オブジェクト
//emlist[例][ruby]{
p 'bar'[2] # => "r"
p 'bar'[2] == ?r # => true
p 'bar'[-1] # => "r"
p 'bar'[3] # => nil
p 'bar'[-4] # => nil
//}
このメソッドの仕様は 1.8.x 以前から大きく変更さ... -
String
# slice(nth , len) -> String | nil (8004.0) -
nth 文字目から長さ len 文字の部分文字列を新しく作って返します。 nth が負の場合は文字列の末尾から数えます。
...い文字列の長さを正の整数で指定します。
@return nth が範囲外を指す場合は nil を返します。
//emlist[例][ruby]{
str0 = "bar"
str0[2, 1] #=> "r"
str0[2, 0] #=> ""
str0[2, 100] #=> "r" (右側を超えても平気)
str0[-1, 1] #=> "r"
st......#=> nil
str1 = str0[0, 2] # (str0 の「一部」を str1 とする)
str1 #=> "ba"
str1[0] = "XYZ"
str1 #=> "XYZa" (str1 の内容が破壊的に変更された)
str0 #=> "bar" (str0 は無傷、 str1 は str0 と内容を共有していない)
//}... -
String
# slice(regexp , name) -> String (8004.0) -
正規表現 regexp の name で指定した名前付きキャプチャにマッチする最初の 部分文字列を返します。正規表現が self にマッチしなかった場合は nil を返 します。
...ない場合に発生します。
//emlist[例][ruby]{
s = "FooBar"
s[/(?<foo>[A-Z]..)(?<bar>[A-Z]..)/] # => "FooBar"
s[/(?<foo>[A-Z]..)(?<bar>[A-Z]..)/, "foo"] # => "Foo"
s[/(?<foo>[A-Z]..)(?<bar>[A-Z]..)/, "bar"] # => "Bar"
s[/(?<foo>[A-Z]..)(?<bar>[A-Z]..)/, "baz"] # => IndexError
//}... -
String
# slice(regexp , nth = 0) -> String (8004.0) -
正規表現 regexp の nth 番目の括弧にマッチする最初の部分文字列を返します。 nth を省略したときや 0 の場合は正規表現がマッチした部分文字列全体を返します。 正規表現が self にマッチしなかった場合や nth に対応する括弧がないときは nil を返します。
...m regexp 取得したい文字列のパターンを示す正規表現
@param nth 取得したい正規表現レジスタのインデックス。整数
//emlist[例][ruby]{
p "foobar"[/bar/] # => "bar"
p $~.begin(0) # => 3
p "def getcnt(line)"[ /def\s+(\w+)/, 1 ] # => "getcnt"
//}... -
String
# scan(pattern) {|s| . . . } -> self (8001.0) -
pattern がマッチした部分文字列をブロックに渡して実行します。 pattern が正規表現で括弧を含む場合は、 括弧で括られたパターンにマッチした文字列の配列を渡します。
...たは正規表現
//emlist[例][ruby]{
"foobarbazfoobarbaz".scan(/ba./) {|s| p s }
# "bar"
# "baz"
# "bar"
# "baz"
"foobarbazfoobarbaz".scan("ba") {|s| p s }
# "ba"
# "ba"
# "ba"
# "ba"
"foobarbazfoobarbaz".scan(/(ba)(.)/) {|s| p s }
# ["ba", "r"]
# ["ba", "z"]
# ["ba", "r"]
# ["ba", "z"]
//}...