10719件ヒット
[1-100件を表示]
(0.203秒)
種類
ライブラリ
- English (99)
- ビルトイン (4130)
- benchmark (33)
- bigdecimal (11)
- cmath (54)
- csv (352)
- date (11)
- dbm (22)
- digest (44)
- drb (11)
- etc (11)
- fiddle (22)
- fileutils (22)
- gdbm (22)
- getoptlong (11)
-
io
/ console (22) - ipaddr (11)
-
irb
/ ext / history (11) -
irb
/ ext / save-history (22) -
irb
/ magic-file (22) - logger (22)
- matrix (103)
- mkmf (143)
-
net
/ ftp (49) -
net
/ http (809) -
net
/ imap (66) -
net
/ pop (44) -
net
/ smtp (56) - nkf (11)
- objspace (11)
- open-uri (33)
- open3 (154)
- openssl (363)
- optparse (286)
- ostruct (22)
- pathname (216)
- pp (11)
- prettyprint (44)
- prime (154)
- psych (198)
- pty (11)
- rake (55)
-
rake
/ packagetask (11) -
rdoc
/ context (22) -
rdoc
/ top _ level (11) - readline (44)
-
rexml
/ document (264) -
rexml
/ parsers / pullparser (11) -
rexml
/ parsers / sax2parser (55) -
rinda
/ rinda (33) -
rinda
/ tuplespace (44) -
ripper
/ lexer (11) -
rubygems
/ commands / unpack _ command (11) -
rubygems
/ config _ file (11) -
rubygems
/ gem _ openssl (11) -
rubygems
/ gem _ path _ searcher (11) -
rubygems
/ package / tar _ input (11) -
rubygems
/ remote _ fetcher (33) -
rubygems
/ requirement (11) -
rubygems
/ source _ index (22) -
rubygems
/ source _ info _ cache (11) -
rubygems
/ version (11) - sdbm (22)
- set (11)
- shell (129)
-
shell
/ builtin-command (30) -
shell
/ command-processor (66) -
shell
/ filter (108) -
shell
/ process-controller (6) -
shell
/ system-command (18) - socket (260)
- stringio (156)
- strscan (110)
- sync (6)
- tempfile (11)
- thread (14)
- thwait (60)
- time (22)
- tmpdir (22)
- tsort (139)
- uri (66)
-
webrick
/ httpauth (22) -
webrick
/ httpauth / authenticator (11) -
webrick
/ httpauth / basicauth (11) -
webrick
/ httpauth / htdigest (11) -
webrick
/ httpauth / htpasswd (11) -
webrick
/ httpproxy (11) -
webrick
/ httprequest (44) -
webrick
/ httpresponse (99) -
webrick
/ httpserver (22) -
webrick
/ httputils (77) -
webrick
/ httpversion (11) -
win32
/ registry (33) -
win32
/ resolv (11) - win32ole (209)
-
yaml
/ dbm (11) - zlib (231)
クラス
-
ARGF
. class (156) - Addrinfo (66)
- Array (313)
- BigDecimal (11)
- Bignum (42)
- CSV (275)
-
CSV
:: FieldInfo (11) -
CSV
:: Row (55) -
CSV
:: Table (11) - Complex (5)
- DBM (22)
- Date (11)
-
Digest
:: Base (44) - Dir (296)
- Encoding (11)
- Enumerator (51)
-
Enumerator
:: ArithmeticSequence (53) -
Enumerator
:: Chain (18) -
Enumerator
:: Lazy (72) - Exception (11)
-
Fiddle
:: Handle (22) - File (132)
-
File
:: Stat (11) - Fixnum (36)
- Float (19)
- GDBM (22)
-
Gem
:: Commands :: UnpackCommand (11) -
Gem
:: ConfigFile (11) -
Gem
:: GemPathSearcher (11) -
Gem
:: Package :: TarInput (11) -
Gem
:: RemoteFetcher (33) -
Gem
:: Requirement (11) -
Gem
:: SourceIndex (22) -
Gem
:: SourceInfoCache (11) -
Gem
:: Version (11) - GetoptLong (11)
- Hash (372)
- IO (414)
- IPAddr (11)
-
IRB
:: Context (33) - Integer (64)
- LoadError (11)
- Logger (22)
- MatchData (92)
- Matrix (103)
- Method (21)
- Module (66)
-
Net
:: FTP (40) -
Net
:: FTP :: MLSxEntry (9) -
Net
:: HTTP (589) -
Net
:: HTTPGenericRequest (22) -
Net
:: HTTPResponse (33) -
Net
:: IMAP (44) -
Net
:: IMAP :: Address (11) -
Net
:: IMAP :: ThreadMember (11) -
Net
:: POP3 (44) -
Net
:: SMTP (56) - NilClass (11)
- Numeric (95)
- Object (67)
-
OpenSSL
:: ASN1 :: Constructive (11) -
OpenSSL
:: ASN1 :: ObjectId (22) -
OpenSSL
:: Config (11) -
OpenSSL
:: PKey :: DH (22) -
OpenSSL
:: PKey :: DSA (66) -
OpenSSL
:: PKey :: RSA (66) -
OpenSSL
:: SSL :: SSLContext (44) -
OpenSSL
:: SSL :: SSLSocket (22) -
OpenSSL
:: X509 :: Store (33) -
OpenSSL
:: X509 :: StoreContext (11) - OpenStruct (22)
- OptionParser (286)
- PP (11)
- Pathname (216)
- PrettyPrint (44)
- Prime (44)
-
Prime
:: PseudoPrimeGenerator (88) -
Psych
:: Handler (11) -
Psych
:: Nodes :: Mapping (22) -
Psych
:: Nodes :: Node (33) -
Psych
:: Nodes :: Scalar (22) -
Psych
:: Nodes :: Sequence (22) -
Psych
:: Stream (22) -
Psych
:: SyntaxError (11) -
Psych
:: Visitors :: YAMLTree (22) -
RDoc
:: Context (22) -
RDoc
:: Options (11) -
RDoc
:: TopLevel (11) -
REXML
:: AttlistDecl (11) -
REXML
:: Attributes (22) -
REXML
:: Child (22) -
REXML
:: Element (55) -
REXML
:: Elements (33) -
REXML
:: Parent (88) -
REXML
:: Parsers :: PullParser (11) -
REXML
:: Parsers :: SAX2Parser (55) -
REXML
:: XPath (22) -
Rake
:: FileList (11) -
Rake
:: PackageTask (11) - Range (119)
- Rational (77)
- Regexp (33)
-
Rinda
:: TupleEntry (11) -
Rinda
:: TupleSpace (33) -
Rinda
:: TupleSpaceProxy (33) - Ripper (11)
-
RubyVM
:: InstructionSequence (11) - SDBM (22)
- Set (11)
- Shell (129)
-
Shell
:: Cat (6) -
Shell
:: CommandProcessor (66) -
Shell
:: Concat (6) -
Shell
:: Echo (6) -
Shell
:: Filter (108) -
Shell
:: Glob (6) -
Shell
:: ProcessController (6) -
Shell
:: SystemCommand (18) -
Shell
:: Tee (6) - Socket (77)
-
Socket
:: AncillaryData (11) -
Socket
:: Ifaddr (7) - String (537)
- StringIO (156)
- StringScanner (110)
- Struct (22)
- Symbol (118)
- Tempfile (11)
- Thread (150)
-
Thread
:: Backtrace :: Location (44) -
Thread
:: Queue (33) -
Thread
:: SizedQueue (42) - ThreadsWait (60)
- Time (33)
- TracePoint (22)
- UNIXServer (44)
- UNIXSocket (55)
-
URI
:: Generic (44) - UnboundMethod (21)
-
WEBrick
:: HTTPAuth :: Htdigest (11) -
WEBrick
:: HTTPAuth :: Htpasswd (11) -
WEBrick
:: HTTPProxyServer (11) -
WEBrick
:: HTTPRequest (44) -
WEBrick
:: HTTPResponse (99) -
WEBrick
:: HTTPServer (22) -
WEBrick
:: HTTPUtils :: FormData (66) -
WEBrick
:: HTTPVersion (11) - WIN32OLE (66)
-
WIN32OLE
_ EVENT (22) -
WIN32OLE
_ METHOD (66) -
WIN32OLE
_ TYPE (44) -
Win32
:: Registry (33) -
Win32
:: Resolv (11) -
YAML
:: DBM (11) -
Zlib
:: Deflate (11) -
Zlib
:: GzipReader (143) -
Zlib
:: GzipWriter (66) -
Zlib
:: Inflate (11)
モジュール
- Benchmark (33)
- CMath (54)
- DRb (11)
- Enumerable (222)
- FileTest (22)
- FileUtils (33)
-
GC
:: Profiler (11) -
Gem
:: SSL (11) - Kernel (374)
- Marshal (22)
- Math (11)
-
Net
:: HTTPHeader (165) - ObjectSpace (33)
- Open3 (154)
-
OpenSSL
:: ASN1 (11) -
OpenSSL
:: Buffering (44) -
OpenURI
:: Meta (33) - PTY (11)
- Process (11)
- Psych (22)
-
REXML
:: Node (11) -
Rake
:: TaskManager (22) - Readline (11)
-
Sync
_ m (6) - TSort (139)
- URI (22)
-
WEBrick
:: HTTPAuth (22) -
WEBrick
:: HTTPAuth :: Authenticator (11) -
WEBrick
:: HTTPUtils (11)
オブジェクト
- ENV (78)
-
IRB
:: MagicFile (22) -
Readline
:: HISTORY (33)
キーワード
-
$ CHILD _ STATUS (11) -
$ INPUT _ LINE _ NUMBER (11) -
$ LAST _ MATCH _ INFO (11) -
$ LAST _ PAREN _ MATCH (11) -
$ LAST _ READ _ LINE (11) -
$ MATCH (11) -
$ NR (11) -
$ POSTMATCH (11) -
$ PREMATCH (11) -
$ ~ (11) - % (12)
- & (6)
- * (39)
- ** (17)
- + (17)
- - (17)
-
/ (17) - < (11)
- <= (11)
- <=> (184)
- == (11)
- =~ (22)
- > (11)
- >= (11)
- BasicAuth (11)
- ConditionVariable (11)
-
DIGEST
_ SHA1 (11) - Location (11)
- Mapping (11)
- Marshal フォーマット (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - NKF (11)
- OPS (11)
-
PATH
_ SEPARATOR (11) - Rubyの起動 (11)
-
WIN32OLE
_ METHOD (11) - [] (254)
- ^ (6)
-
_ _ method _ _ (11) -
absolute
_ path (22) -
add
_ response _ handler (22) -
alias
_ command (6) -
all
_ waits (18) - anchor (33)
- angle (11)
- append (18)
- arg (11)
- ascend (11)
- asin (6)
- asinh (6)
- assoc (11)
- at (11)
- backtrace (11)
-
backtrace
_ locations (22) -
base
_ label (11) -
basic
_ auth (11) - begin (16)
- benchmark (11)
- binread (22)
- binwrite (11)
-
block
_ length (11) - bm (11)
- bmbm (11)
- body (44)
-
body
_ stream (11) -
body
_ stream= (11) - bsearch (44)
-
bsearch
_ index (18) - byteoffset (4)
- bytes (14)
- byteslice (22)
-
ca
_ file (11) -
ca
_ path (22) - caller (11)
-
caller
_ locations (22) -
canonical
_ each (11) - casecmp (22)
- casecmp? (16)
- cat (18)
- catch (22)
- cbrt (6)
- cert (11)
-
cert
_ store (11) - cgi (11)
- chain (22)
- chardev? (22)
- chars (50)
- charset (31)
- chdir (66)
- check (22)
-
check
_ signedness (22) -
check
_ sizeof (22) -
check
_ until (11) - children (6)
- chomp! (11)
- chop! (11)
- chown (11)
- chr (11)
- chunk (11)
-
chunk
_ while (19) - ciphers (11)
- classify (11)
-
clock
_ gettime (11) - close (9)
- collect (35)
- collect! (12)
- compact! (8)
-
connect
_ from (22) -
connect
_ to (22) -
content
_ length (22) -
content
_ length= (11) -
content
_ range (11) -
content
_ type (33) -
continue
_ timeout (11) -
datetime
_ format (11) - debug (23)
- debug? (12)
-
debug
_ output _ exclusive _ unlock (3) -
debug
_ output _ unlock (6) -
def
_ system _ command (6) - default (22)
-
default
_ proc (11) - delete (44)
-
delete
_ at (22) -
delete
_ if (33) - deq (11)
- descend (11)
- dig (9)
-
digest
_ length (11) - div (6)
- document (11)
-
drop
_ while (55) - each (594)
-
each
_ active _ object (6) -
each
_ attribute (22) -
each
_ byte (99) -
each
_ capitalized (11) -
each
_ capitalized _ name (11) -
each
_ char (88) -
each
_ child (84) -
each
_ classmodule (11) -
each
_ codepoint (88) -
each
_ cons (11) -
each
_ data (11) -
each
_ element (11) -
each
_ element _ with _ attribute (11) -
each
_ element _ with _ text (11) -
each
_ entry (11) -
each
_ filename (11) -
each
_ grapheme _ cluster (14) -
each
_ index (44) -
each
_ key (11) -
each
_ line (209) -
each
_ mail (11) -
each
_ object (22) -
each
_ option (11) -
each
_ pair (132) -
each
_ prime (22) -
each
_ recursive (11) -
each
_ slice (22) -
each
_ strongly _ connected _ component (32) -
each
_ strongly _ connected _ component _ from (42) -
each
_ value (11) -
each
_ with _ index (66) -
each
_ with _ object (22) - echo (18)
- empty? (14)
- end (17)
-
enhance
_ with _ matching _ rule (11) - entity (11)
-
enum
_ for (22) - escape (11)
-
eval
_ history (11) -
event
_ interface (11) - exp (6)
- export (44)
-
extra
_ chain _ cert (11) - extract (22)
- fdiv (17)
- fetch (117)
-
fetch
_ path (11) - field (11)
- file (11)
- filename (22)
- filename= (11)
- fill (22)
- filter (51)
- filter! (12)
- find (33)
-
find
_ executable (11) -
find
_ local _ symbol (11) - finish (11)
- finished? (6)
- first (23)
- flush (22)
- fnmatch (11)
- fnmatch? (11)
- foreach (128)
- fork (11)
- format (11)
- gamma (11)
- generate (33)
-
generate
_ line (11) - get (22)
- get2 (22)
-
get
_ hosts _ path (11) -
get
_ path (11) -
get
_ proxy _ from _ env (11) -
get
_ text (11) - getc (11)
- getch (11)
- gets (48)
- glob (47)
-
grapheme
_ clusters (14) -
group
_ by (11) - gsub (33)
- gsub! (22)
- handler= (11)
- head (11)
- head2 (22)
- header (11)
-
header
_ convert (22) - headers (11)
- help (11)
- helpcontext (22)
- helpfile (22)
- helpstring (22)
-
history
_ file (11) - home (22)
- host (22)
- hostname (22)
- index (11)
- inject (11)
- input (6)
- inspect (11)
-
install
_ system _ commands (6) - instance (22)
-
instance
_ method (11) - invert (11)
- irb (11)
- join (28)
-
join
_ nowait (6) -
keep
_ if (22) - key (11)
- last (12)
-
last
_ match (11) - length (22)
- libpathflag (11)
- lineno (11)
- lineno= (11)
- lines (30)
-
link
_ command (11) - listen (55)
- load (11)
-
load
_ stream (22) -
local
_ host (11) -
local
_ port (11) -
locale
_ charmap (11) - log (12)
- logger (11)
-
main
_ type (11) - map (24)
- map! (12)
- match (55)
- match? (11)
- matched (11)
-
matched
_ size (11) - matchedsize (11)
- max (22)
-
max
_ by (44) -
method
_ id (11) -
method
_ missing (11) - min (42)
- minmax (10)
- mktmpdir (22)
- mlsd (18)
- modulo (6)
-
mount
_ proc (22) - name (11)
- name= (11)
-
net
/ imap (11) - new (211)
-
next
_ wait (6) - noecho (11)
- notify (18)
- offset (22)
-
ole
_ func _ methods (11) -
ole
_ get _ methods (11) -
ole
_ methods (11) -
ole
_ obj _ help (11) -
ole
_ type (11) - on (88)
-
on
_ event _ with _ outargs (11) -
on
_ head (11) -
on
_ tail (11) - open (260)
-
open
_ timeout (11) -
open
_ uri _ or _ path (11) - opendir (22)
- optparse (11)
- out (6)
- pack (19)
- pack テンプレート文字列 (11)
-
package
_ dir _ path (11) -
page
_ dir (11) - parent (11)
- parse (44)
- parse! (11)
-
parse
_ line (11) - pass (11)
- patch (22)
- path (79)
- pathconf (11)
- pathmap (11)
- peek (11)
-
peer
_ cert (11) -
peer
_ cert _ chain (11) - permutation (22)
- phase (11)
-
pipeline
_ r (22) -
pipeline
_ rw (22) -
pipeline
_ start (22) -
pipeline
_ w (22) - pop (11)
- popen2 (22)
- popen2e (22)
- popen3 (22)
- pos (11)
- post (22)
- post2 (22)
-
post
_ match (11) -
pre
_ match (11) -
proxy
_ address (22) -
proxy
_ basic _ auth (11) -
proxy
_ pass (22) -
proxy
_ port (22) -
proxy
_ uri (11) -
proxy
_ user (22) - proxyaddr (11)
- proxyport (11)
- put2 (22)
- putc (11)
- quo (22)
- rake (11)
- range (11)
-
range
_ length (11) - rassoc (11)
- raw (11)
-
raw
_ data (11) -
reachable
_ objects _ from (11) - read (121)
-
read
_ all (22) -
read
_ body (11) -
read
_ timeout (11) - readchar (11)
- readline (11)
- readlines (35)
-
reason
_ phrase (11) - reject (22)
- reject! (22)
- remainder (14)
- request (22)
-
request
_ get (22) -
request
_ head (22) -
request
_ method (11) -
request
_ post (22) -
request
_ put (22) -
request
_ uri (11) - restore (11)
-
reverse
_ each (11) -
rexml
/ parsers / ultralightparser (11) - round (12)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 4 feature (11) -
save
_ history (11) - scalar (11)
- scheme (11)
- scrub (33)
- scrub! (33)
- select (18)
- select! (22)
- separator (11)
- seplist (11)
- seqno (11)
-
set
_ dictionary (22) -
set
_ trace _ func (11) - sh (11)
- shift (77)
-
short
_ name (11) - sin (6)
-
singleline
_ format (11) - sinh (6)
- size (52)
- size? (29)
-
size
_ opt _ params (11) -
size
_ params (11) - slice (77)
- slice! (11)
-
slice
_ when (21) - sn (11)
-
source
_ location (22) - split (12)
- sqrt (6)
- squeeze! (11)
-
ssl
_ params (11) -
ssl
_ timeout (11) -
ssl
_ version (11) - start (111)
- status (11)
- step (24)
- store (11)
-
strongly
_ connected _ components (11) - strptime (22)
- sub (33)
- sub! (22)
-
sub
_ type (11) - summarize (22)
-
summary
_ indent (11) -
summary
_ indent= (11) -
summary
_ width (11) -
summary
_ width= (11) -
super
_ method (20) -
sync
_ ex _ locker (6) -
synthesize
_ file _ task (11) - sysseek (11)
- system (6)
- table (11)
- tag (44)
- take (22)
-
take
_ while (66) - tcp (22)
- tee (18)
- tell (11)
- test (18)
- text (11)
- thread (11)
-
thread
_ variable _ get (11) - threads (6)
-
tmp
_ dh _ callback (11) -
to
_ a (11) -
to
_ enum (22) -
to
_ h (12) -
to
_ path (24) -
to
_ pem (44) -
to
_ s (72) -
to
_ yaml (11) -
token
_ match (11) -
trace
_ var (22) - transact (6)
-
transform
_ keys (17) -
transform
_ keys! (17) -
transform
_ values (16) -
transform
_ values! (16) - traverse (11)
- tree (11)
- truncate (11)
-
try
_ constant (22) -
try
_ convert (11) -
try
_ file (11) - tsort (11)
-
tsort
_ each (32) -
tsort
_ each _ child (11) -
uid
_ store (11) -
unalias
_ command (6) - ungetc (11)
- unix (22)
-
unix
_ rights (11) -
unix
_ server _ loop (11) -
unix
_ server _ socket (22) - unpack (11)
-
untrace
_ var (11) - userdb (11)
- value (11)
- verify (22)
-
verify
_ depth (11) -
verify
_ mode (11) - vhid (7)
-
with
_ config (22) -
with
_ index (54) -
with
_ object (44) -
with
_ werror (22) -
world
_ readable? (22) - wrap (22)
-
write
_ headers? (11) -
write
_ timeout (6) - yaml (11)
-
yield
_ self (12) - 正規表現 (11)
検索結果
先頭5件
-
irb (26120.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...irb は Interactive Ruby の略です。
irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
=== irb の使い方
Ruby さえ知っていれば irb を使うのは簡単です。
irb コマンドを実行すると、以下のようなプロン......ibrary ruby -r と同じ
-I ruby -I と同じ
-U ruby -U と同じ
-E enc ruby -E と同じ
--verbose これから実行する行を表示する
--noverbose これから実行する行を表示しない (デフォルト)
--ech......ブジェクトに
IRB::Context オブジェクトを渡して実行します。
これによってサブ irb の設定をまとめて設定することができます。
以下に例を示します。
$ irb
irb(main):001:0> IRB.conf[:IRB_RC] = lambda {|conf| conf.prompt_i = "> " }
=> #<Proc... -
Shell
:: Filter # |(filter) -> object (24248.0) -
パイプ結合を filter に対して行います。
...を filter に対して行います。
@param filter Shell::Filter オブジェクトを指定します。
@return filter を返します。
使用例
require 'shell'
Shell.def_system_command("tail")
Shell.def_system_command("head")
Shell.def_system_command("wc")
sh = Shell.new
sh.tra......nsact {
i = 1
while i <= (cat("/etc/passwd") | wc("-l")).to_s.chomp.to_i
puts (cat("/etc/passwd") | head("-n #{i}") | tail("-n 1")).to_s
i += 1
end
}... -
Prime
:: PseudoPrimeGenerator # each _ with _ index {|prime , index| . . . } -> self (21414.0) -
与えられたブロックに対して、素数を0起点の連番を渡して評価します。
...を返します。 ブロックを与えられなかった場合は Enumerator を返します。
//emlist[例][ruby]{
require 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}
@see Enumerator#with_index... -
Prime
:: PseudoPrimeGenerator # each _ with _ index -> Enumerator (21314.0) -
与えられたブロックに対して、素数を0起点の連番を渡して評価します。
...を返します。 ブロックを与えられなかった場合は Enumerator を返します。
//emlist[例][ruby]{
require 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}
@see Enumerator#with_index... -
Bignum
# |(other) -> Fixnum | Bignum (21313.0) -
ビット二項演算子。論理和を計算します。
...ビット二項演算子。論理和を計算します。
@param other 数値
1 | 1 #=> 1
2 | 3 #=> 3... -
Fixnum
# |(other) -> Fixnum | Bignum (21313.0) -
ビット二項演算子。論理和を計算します。
...ビット二項演算子。論理和を計算します。
@param other 数値
1 | 1 #=> 1
2 | 3 #=> 3... -
Integer
# |(other) -> Integer (21312.0) -
ビット二項演算子。論理和を計算します。
...ビット二項演算子。論理和を計算します。
@param other 数値
//emlist[][ruby]{
1 | 1 # => 1
2 | 3 # => 3
//}... -
NilClass
# |(other) -> bool (21224.0) -
other が真なら true を, 偽なら false を返します。
...other が真なら true を, 偽なら false を返します。
@param other 論理和を行なう式です
//emlist[例][ruby]{
nil | true # => true
nil | false # => false
nil | nil # => false
nil | "a" # => true
//}... -
Enumerable
# each _ with _ index(*args) {|item , index| . . . } -> self (18549.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...ith_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。
@param args イテレータメソッド (each など) にそのまま渡されます。
//emlist[例][ruby]{
[5, 10, 15].each_with......_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}
//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}
@see Enumerator#with_index... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (18425.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...ます。
maxを指定すると、対象となる子要素の先頭 max 個のみが対象となります。
name を指定すると、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。
max に 0 を指定すると、max の指定は無視さ......h文字列
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a><b id='1'/><c id='2'/><d id='1'/><e/></a>")
doc.root.each_element_with_attribute('id'){|e| p e }
# >> <b id='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1'){|e| p e }
# >> <b i......d='1'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1', 1){|e| p e }
# >> <b id='1'/>
doc.root.each_element_with_attribute('id', '1', 0, 'd'){|e| p e }
# >> <d id='1'/>
//}... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (18425.0) -
テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。
...ます。
maxを指定すると、対象となる子要素の先頭 max 個のみが対象となります。
name を指定すると、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。
max に 0 を指定すると、max の指定は無視さ......個数
@param name xpath文字列
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
doc.root.each_element_with_text {|e|p e}
# >> <b> ... </>
# >> <c> ... </>
# >> <d> ... </>
doc.root.each_element_with_text('b'){|e|p e}
# >> <b> ... </>
# >>......<c> ... </>
doc.root.each_element_with_text('b', 1){|e|p e}
# >> <b> ... </>
doc.root.each_element_with_text(nil, 0, 'd'){|e|p e}
# >> <d> ... </>
//}...