9433件ヒット
[1-100件を表示]
(0.141秒)
ライブラリ
- ビルトイン (4744)
-
cgi
/ core (11) - csv (110)
- date (44)
- dbm (110)
- drb (22)
-
drb
/ extservm (11) - expect (22)
- fiddle (33)
-
fiddle
/ import (22) - gdbm (88)
- getoptlong (33)
-
io
/ wait (33) -
irb
/ context (22) - matrix (233)
-
minitest
/ unit (1) - mkmf (110)
-
net
/ ftp (159) -
net
/ http (281) -
net
/ imap (154) -
net
/ pop (22) -
net
/ smtp (28) -
net
/ telnet (2) - open-uri (121)
- openssl (264)
- optparse (242)
- ostruct (43)
- pathname (100)
- prime (121)
- pstore (11)
- psych (66)
- rake (99)
-
rdoc
/ context (88) -
rdoc
/ markup (11) -
rdoc
/ text (11) -
rdoc
/ top _ level (22) - resolv (11)
-
rexml
/ document (341) -
rexml
/ parsers / pullparser (22) -
rinda
/ rinda (33) -
rinda
/ tuplespace (55) - ripper (11)
-
ripper
/ filter (11) -
rubygems
/ command (11) -
rubygems
/ commands / unpack _ command (11) -
rubygems
/ config _ file (11) -
rubygems
/ dependency _ list (11) -
rubygems
/ package / tar _ input (22) -
rubygems
/ package / tar _ output (11) -
rubygems
/ remote _ fetcher (33) -
rubygems
/ source _ index (33) -
rubygems
/ source _ info _ cache (11) -
rubygems
/ specification (22) -
rubygems
/ user _ interaction (55) - scanf (12)
- sdbm (88)
- set (33)
- shell (18)
-
shell
/ command-processor (6) -
shell
/ filter (12) - socket (99)
- stringio (105)
- strscan (88)
- thread (18)
- timeout (22)
- tracer (11)
- tsort (30)
- uri (187)
-
webrick
/ httpauth / authenticator (11) -
webrick
/ httpauth / htdigest (11) -
webrick
/ httpauth / htpasswd (11) -
webrick
/ httprequest (44) -
webrick
/ httpresponse (22) -
webrick
/ httpserver (22) -
webrick
/ httputils (66) -
win32
/ registry (33) - win32ole (110)
-
yaml
/ dbm (33) - zlib (110)
クラス
-
ARGF
. class (128) - Array (452)
- BasicSocket (11)
- Bignum (57)
- CSV (33)
-
CSV
:: Row (44) -
CSV
:: Table (33) - Class (11)
- DBM (110)
-
DRb
:: DRbObject (11) -
DRb
:: DRbServer (11) -
DRb
:: ExtServManager (11) - Data (2)
- Date (44)
- Dir (17)
- Enumerator (99)
-
Enumerator
:: ArithmeticSequence (53) -
Enumerator
:: Chain (18) -
Enumerator
:: Lazy (320) -
Enumerator
:: Yielder (27) - Exception (11)
-
Fiddle
:: Function (33) - File (22)
-
File
:: Stat (11) - Fixnum (54)
- Float (27)
- GDBM (88)
-
Gem
:: Command (11) -
Gem
:: Commands :: UnpackCommand (11) -
Gem
:: ConfigFile (11) -
Gem
:: DependencyList (11) -
Gem
:: Package :: TarInput (22) -
Gem
:: Package :: TarOutput (11) -
Gem
:: RemoteFetcher (33) -
Gem
:: SourceIndex (33) -
Gem
:: SourceInfoCache (11) -
Gem
:: Specification (22) -
Gem
:: StreamUI (55) - GetoptLong (33)
- Hash (391)
- IO (281)
-
IRB
:: Context (22) - Integer (52)
- Matrix (155)
-
Matrix
:: LUPDecomposition (11) - Method (32)
-
MiniTest
:: Unit (1) - Module (258)
-
Net
:: FTP (150) -
Net
:: FTP :: MLSxEntry (9) -
Net
:: HTTP (204) -
Net
:: HTTPGenericRequest (22) -
Net
:: IMAP (33) -
Net
:: IMAP :: Address (11) -
Net
:: IMAP :: BodyTypeBasic (11) -
Net
:: IMAP :: BodyTypeMessage (22) -
Net
:: IMAP :: BodyTypeMultipart (44) -
Net
:: IMAP :: BodyTypeText (11) -
Net
:: IMAP :: Envelope (11) -
Net
:: IMAP :: ResponseError (11) -
Net
:: POP3 (22) -
Net
:: SMTP (28) -
Net
:: Telnet (2) - Numeric (173)
- Object (68)
-
OpenSSL
:: ASN1 :: Constructive (22) -
OpenSSL
:: BN (11) -
OpenSSL
:: Config (44) -
OpenSSL
:: OCSP :: BasicResponse (11) -
OpenSSL
:: PKey :: EC (11) -
OpenSSL
:: PKey :: EC :: Group (22) -
OpenSSL
:: SSL :: SSLContext (22) -
OpenSSL
:: X509 :: ExtensionFactory (33) -
OpenSSL
:: X509 :: StoreContext (11) - OpenStruct (43)
- OptionParser (198)
- PStore (11)
- Pathname (100)
- Prime (22)
-
Prime
:: PseudoPrimeGenerator (99) - Proc (33)
-
Process
:: Status (33) -
Psych
:: Handler (11) -
Psych
:: Nodes :: Node (11) -
Psych
:: Nodes :: Sequence (22) -
Psych
:: Stream (22) -
RDoc
:: Context (88) -
RDoc
:: Markup (11) -
RDoc
:: Options (22) -
RDoc
:: TopLevel (22) -
REXML
:: AttlistDecl (11) -
REXML
:: Attribute (11) -
REXML
:: Attributes (55) -
REXML
:: Child (11) -
REXML
:: DocType (22) -
REXML
:: Document (33) -
REXML
:: Element (66) -
REXML
:: Entity (33) -
REXML
:: Instruction (11) -
REXML
:: NotationDecl (11) -
REXML
:: Parent (44) -
REXML
:: Parsers :: PullParser (22) -
Rake
:: FileList (22) -
Rake
:: TaskArguments (11) - Range (51)
- Rational (33)
- Regexp (11)
-
Resolv
:: DNS (11) -
Rinda
:: TupleEntry (11) -
Rinda
:: TupleSpace (44) -
Rinda
:: TupleSpaceProxy (33) - Ripper (11)
-
Ripper
:: Filter (11) -
RubyVM
:: InstructionSequence (11) - SDBM (88)
- Set (11)
- Shell (18)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (12) -
Socket
:: AncillaryData (11) - String (475)
- StringIO (105)
- StringScanner (88)
- Struct (99)
- Symbol (52)
- Thread (51)
-
Thread
:: Backtrace :: Location (11) -
Thread
:: Queue (75) -
Thread
:: SizedQueue (42) - Time (11)
- TracePoint (28)
- Tracer (11)
- TrueClass (11)
- UNIXServer (22)
- UNIXSocket (55)
-
URI
:: FTP (11) -
URI
:: Generic (176) - UnboundMethod (32)
- Vector (67)
-
WEBrick
:: HTTPAuth :: Htdigest (11) -
WEBrick
:: HTTPAuth :: Htpasswd (11) -
WEBrick
:: HTTPRequest (44) -
WEBrick
:: HTTPResponse (22) -
WEBrick
:: HTTPServer (22) -
WEBrick
:: HTTPUtils :: FormData (66) - WIN32OLE (22)
-
WIN32OLE
_ EVENT (11) -
WIN32OLE
_ PARAM (22) -
WIN32OLE
_ TYPE (44) -
WIN32OLE
_ VARIABLE (11) -
Win32
:: Registry (33) -
YAML
:: DBM (33) -
Zlib
:: GzipFile :: Error (11) -
Zlib
:: GzipReader (66) -
Zlib
:: GzipWriter (33)
モジュール
-
CGI
:: QueryExtension (11) - Enumerable (1228)
-
Fiddle
:: Importer (22) - FileUtils (22)
- Kernel (143)
-
Net
:: HTTPHeader (55) -
OpenSSL
:: Buffering (77) -
OpenURI
:: Meta (88) -
OpenURI
:: OpenRead (33) -
OptionParser
:: Arguable (44) -
RDoc
:: Text (11) -
REXML
:: Node (33) -
Rake
:: TaskManager (33) - TSort (30)
-
WEBrick
:: HTTPAuth :: Authenticator (11)
キーワード
- % (18)
- & (6)
- * (6)
- ** (6)
- + (6)
- - (6)
-
/ (6) - < (11)
- << (17)
- <= (11)
- <=> (25)
- == (11)
- > (11)
- >= (11)
- >> (6)
- [] (66)
- ^ (6)
-
_ _ drburi (11) - abs (6)
-
absolute
_ path (22) - accept (11)
-
add
_ bindir (11) -
add
_ class (11) -
add
_ class _ or _ module (22) -
add
_ gem _ contents (11) -
add
_ module (11) -
add
_ option (11) -
add
_ trace _ func (11) - addr (11)
- alert (11)
-
alert
_ error (11) -
alert
_ warning (11) - all? (29)
- anchor (11)
- angle (11)
- any? (29)
-
append
_ features (11) - arg (11)
-
arg
_ config (11) - ascend (11)
- ask (11)
- attribute (11)
-
attribute
_ of (11) - autoclose? (11)
- autoload? (11)
-
base
_ uri (11) - begin (5)
- bind (11)
- body (33)
-
body
_ stream (11) -
body
_ stream= (11) - bsearch (22)
-
bsearch
_ index (9) - bytes (21)
- byteslice (33)
- call (11)
-
canonical
_ each (11) - casecmp (22)
- casecmp? (16)
- cause (11)
- chars (21)
- charset (22)
-
check
_ signedness (22) -
check
_ until (11) - chown (11)
- chunk (33)
-
chunk
_ while (19) -
class
_ eval (22) -
class
_ exec (11) - clear (11)
- close (9)
- closed? (9)
- codepoints (21)
- cofactor (11)
-
cofactor
_ expansion (11) - collect (66)
- collect! (23)
- collect2 (11)
-
collect
_ concat (33) - column (44)
- combination (11)
- content (11)
-
content
_ encoding (11) -
content
_ type (22) -
continue
_ timeout (11) - convert (11)
- count (66)
-
create
_ body (11) -
create
_ rule (11) -
current
_ crl (11) - curry (22)
-
curve
_ name (11) - cycle (33)
- debug (6)
- debug? (6)
- dedup (2)
- default (33)
-
default
_ argv= (11) -
default
_ event _ sources (11) -
default
_ executable (11) -
default
_ ole _ types (11) -
default
_ port (11) -
default
_ proc (11) -
default
_ proc= (11) -
defined
_ class (11) - delete (11)
-
delete
_ attribute (11) -
delete
_ if (88) -
delete
_ suffix! (7) - deq (22)
- descend (11)
- detect (22)
- dig (18)
- disposition (11)
- div (6)
-
do
_ not _ reverse _ lookup (11) - doctype (11)
- document (22)
- downto (22)
-
drop
_ while (44) - dup (11)
- each (519)
- each2 (11)
-
each
_ attribute (22) -
each
_ byte (66) -
each
_ capitalized (11) -
each
_ char (44) -
each
_ child (39) -
each
_ classmodule (11) -
each
_ codepoint (44) -
each
_ cons (22) -
each
_ data (11) -
each
_ element _ with _ attribute (11) -
each
_ entry (24) -
each
_ grapheme _ cluster (14) -
each
_ index (22) -
each
_ key (22) -
each
_ line (110) -
each
_ pair (99) -
each
_ recursive (11) -
each
_ resource (11) -
each
_ slice (22) -
each
_ strongly _ connected _ component (10) -
each
_ strongly _ connected _ component _ from (10) -
each
_ value (88) -
each
_ with _ index (55) -
each
_ with _ object (22) - eager (5)
- egrep (11)
-
enable
_ config (22) - encode (33)
- end (6)
-
enhance
_ with _ matching _ rule (11) -
enum
_ for (44) - exclude (11)
- exitstatus (11)
- expect (22)
- expunge (11)
-
extend
_ object (11) - extension (11)
- fdiv (17)
- fetch (40)
-
fetch
_ path (11) -
fetch
_ values (18) - field (11)
- filename (11)
- filename= (11)
- filter (48)
- filter! (18)
-
filter
_ map (15) - find (43)
-
find
_ all (33) -
find
_ enclosing _ module _ named (11) -
find
_ executable (11) -
find
_ first _ recursive (11) -
find
_ index (66) -
find
_ local _ symbol (11) -
find
_ module _ named (11) -
find
_ name (11) -
find
_ proxy (11) - first (34)
-
flat
_ map (33) - floor (1)
- flush (22)
-
force
_ quotes? (11) - fragment (11)
- get (22)
-
get
_ attribute (11) -
get
_ attribute _ ns (11) -
get
_ byte (11) -
get
_ path (11) -
get
_ proxy _ from _ env (11) -
get
_ value (11) - getbinaryfile (22)
- getbyte (11)
- getc (11)
- getch (11)
- getquotaroot (11)
- gets (11)
-
grapheme
_ clusters (14) - grep (33)
-
grep
_ v (31) -
group
_ by (22) - gsub (44)
- gsub! (44)
- guid (11)
- headers (11)
- host (11)
- hostname (11)
- index (55)
- inject (33)
- input (17)
- inspect (11)
-
instance
_ method (11) -
instruction
_ sequence (6) -
issuer
_ certificate (11) -
keep
_ if (33) - key (44)
- language (44)
-
laplace
_ expansion (11) - last (12)
-
last
_ modified (11) - lazy (11)
- length (11)
- lineno= (11)
- lines (49)
-
load
_ gemspec (11) - lookup (11)
- magnitude (6)
- map (66)
- map! (23)
- match? (11)
-
matched
_ size (11) - max (44)
-
max
_ by (44) - merge (11)
- min (44)
-
min
_ by (44) - minmax (22)
-
minmax
_ by (22) - mlsd (18)
-
module
_ eval (22) -
module
_ exec (11) -
module
_ function (12) - modulo (6)
-
mount
_ proc (22) - name (33)
- name= (11)
- namespace (11)
- none? (29)
- nonzero? (11)
- normalize (11)
- normalize! (11)
- notify (11)
-
ole
_ func _ methods (11) -
ole
_ query _ interface (11) -
on
_ event _ with _ outargs (11) -
on
_ head (11) -
on
_ tail (11) - one? (29)
- opaque (11)
- open (22)
-
open
_ timeout (22) -
open
_ uri _ or _ path (11) - order! (44)
- out (18)
- output? (11)
- owner (22)
- pack (19)
- parse (33)
- parse! (11)
- partition (22)
- parts (11)
- password (11)
- path (22)
- peek (11)
- peeraddr (11)
- permutation (22)
- permute (22)
- permute! (11)
- phase (11)
- pop (22)
- port (11)
- pread (7)
-
previous
_ element (11) -
previous
_ sibling _ node (11) - private (16)
- product (22)
-
progress
_ reporter (11) - protected (16)
-
proxy
_ uri (11) -
proxy
_ user (11) - ptr (11)
- pubid (11)
- public (38)
-
public
_ key (11) - push (22)
- put (22)
- put2 (22)
- putbinaryfile (22)
- putc (11)
- puts (22)
- puttextfile (22)
- pwrite (7)
- query (11)
- quiet (11)
- quiet? (11)
- quo (22)
- rassoc (11)
- read (66)
-
read
_ all (22) -
read
_ nonblock (31) -
read
_ timeout (22) - readpartial (11)
-
recv
_ io (11) - recvfrom (11)
- reduce (33)
- registry (11)
- reject (99)
- reject! (66)
- remainder (14)
-
repeated
_ combination (11) -
repeated
_ permutation (22) - request (22)
-
request
_ get (22) -
request
_ head (22) -
request
_ method (11) -
request
_ post (22) -
request
_ put (22) -
request
_ uri (11) -
respond
_ to? (11) - response (11)
-
return
_ value (11) -
reverse
_ each (33) - rindex (11)
- root (11)
-
root
_ node (11) - round (34)
- route (11)
- ruby (11)
- rule (11)
- run (1)
- scalar (11)
-
scan
_ until (11) - scanf (12)
- scheme (11)
- scrub (33)
- scrub! (33)
- seed (11)
- select (121)
- select! (33)
-
set
_ encoding _ by _ bom (5) -
set
_ trace _ func (11) - setuid? (11)
- sh (11)
- shift (22)
- size (34)
-
skip
_ until (11) - slice (22)
-
slice
_ after (42) -
slice
_ before (55) -
slice
_ when (21) - solve (11)
- sort (22)
-
sort
_ by (22) -
sort
_ by! (11) - source (11)
-
source
_ location (33) -
source
_ ole _ types (11) - specification (11)
- squeeze! (11)
-
ssl
_ timeout (22) - start (72)
- status (33)
- step (112)
- stopsig (11)
- sub (55)
- sub! (33)
-
sub
_ type (11) - subject (11)
-
subject
_ certificate (11) -
subject
_ request (11) - subsec (11)
- succ (3)
- sum (49)
- summarize (22)
-
summary
_ indent (11) -
summary
_ indent= (11) -
summary
_ width (11) -
summary
_ width= (11) -
super
_ method (20) - superclass (11)
- sysaccept (11)
- tag (11)
- tagging (11)
- take (22)
-
take
_ while (55) - terminated? (11)
- termsig (11)
- then (6)
- timeout (33)
- times (11)
-
to
_ a (11) -
to
_ enum (44) -
to
_ h (44) -
to
_ proc (5) -
to
_ s (11) -
to
_ set (22) -
trace
_ func (11) -
transform
_ keys (7) -
transform
_ keys! (7) -
transform
_ values (16) -
transform
_ values! (16) - truncate (34)
-
try
_ file (11) -
try
_ run (22) -
tsort
_ each (10) - typecode (11)
- ucmp (11)
-
uid
_ store (11) - ungetc (11)
- uniq (60)
- uniq! (22)
- unique (9)
-
unix
_ rights (11) - unnormalized (11)
- unpack (11)
- unused (11)
- upcase! (11)
- update (33)
-
upper
_ bound (11) - upto (55)
- uri (22)
-
use
_ readline (11) -
use
_ readline? (11) - user (11)
- userdb (11)
- userinfo (11)
- value (66)
- visibility (22)
- wait (11)
-
wait
_ readable (11) -
wait
_ writable (11) - waitfor (2)
-
with
_ config (22) -
with
_ index (54) -
with
_ object (44) -
write
_ nonblock (11) -
write
_ timeout (6) -
xml
_ decl (11) - yield (11)
-
yield
_ self (7) - zip (33)
- ~ (6)
検索結果
先頭5件
-
Bignum
# |(other) -> Fixnum | Bignum (21314.0) -
ビット二項演算子。論理和を計算します。
...ビット二項演算子。論理和を計算します。
@param other 数値
1 | 1 #=> 1
2 | 3 #=> 3... -
Fixnum
# |(other) -> Fixnum | Bignum (21314.0) -
ビット二項演算子。論理和を計算します。
...ビット二項演算子。論理和を計算します。
@param other 数値
1 | 1 #=> 1
2 | 3 #=> 3... -
TrueClass
# |(other) -> bool (21143.0) -
常に true を返します。
...true を返します。
@param other 論理和を行なう式です。
| は再定義可能な演算子に分類されていますので、通常は true | other のように使われます。
//emlist[例][ruby]{
p true | true #=> true
p true | false #=> true
p true | nil #=> true
p......true | (1 == 1) #=> true
p true | (1 + 1) #=> true
p true.|(true) #=> true
p true.|(false) #=> true
p true.|(nil) #=> true
p true.|(1 == 1) #=> true
p true.|(1 + 1) #=> true
//}... -
Set
# |(enum) -> Set (15201.0) -
和集合、すなわち、2 つの集合の少なくともどちらか一方に属するすべての 要素からなる新しい集合を作ります。
...しい集合を作ります。
@param enum each メソッドが定義されたオブジェクトを指定します。
@raise ArgumentError 引数 enum に each メソッドが定義されていない場合に
発生します。
//emlist[][ruby]{
require 'set'
p Set[10, 20, 30] + Set[10, 20,... -
WIN32OLE
_ PARAM # output? -> bool (12213.0) -
パラメータがクライアントからの結果を受け取るためのものかを判定します。
...M#input?が真)、out(サーバがクライアントへ与える。
WIN32OLE_PARAM#output?が真)および、inout(クライアントからサーバ
へ与え、サーバがクライアントへ与える)の3種類の方向属性のいずれかを持ち
ます。
output?メソッドはout属......inout属性なら真を返します。
@return メソッドの方向属性がoutまたはinoutならば真を返します。
tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'DWebBrowserEvents')
method = WIN32OLE_METHOD.new(tobj, 'NewWindow')
method.params.each do |param|
puts......"#{param.name} #{param.output?}"
end
The result of above script is following:
URL false
Flags false
TargetFrameName false
PostData false
Headers false
Processed true
@see http://msdn.microsoft.com/en-us/library/aa367136(v=VS.85).aspx... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (9321.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......うに、Lazy#to_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。
//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0......?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end
r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげ... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (9321.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......うに、Lazy#to_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。
//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0......?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end
r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげ... -
REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () (9314.0) -
各属性に対しブロックを呼び出します。
...各属性に対しブロックを呼び出します。
個々の属性は REXML::Attribute オブジェクトで渡されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a fo......o:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes.each_attribute do |attr|
p [attr.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => ["", "att", "<"]
//}... -
REXML
:: Attributes # get _ attribute(name) -> Attribute | nil (9302.0) -
name という名前の属性を取得します。
...Attributes#[]
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes.get_attribute("at......t") # => att='<'
a.attributes.get_attribute("foo:att") # => foo:att='1'
//}... -
REXML
:: Attributes # get _ attribute _ ns(namespace , name) -> REXML :: Attribute | nil (9302.0) -
namespace と name で特定される属性を返します。
...ことで属性を正しく指定することができます。
@param namespace 名前空間(URI, 文字列)
@param name 属性名(文字列)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/......et_elements("/root/a").first
a.attributes.get_attribute_ns("", "att") # => att='<'
a.attributes.get_attribute_ns("http://example.org/foo", "att") # => foo:att='1'
a.attributes.get_attribute_ns("http://example.org/baz", "att") # => nil
a.attributes.get_attribute_ns("http://example.org/foo", "attt... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) -> Enumerator :: Lazy (9221.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......うに、Lazy#to_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。
//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0......?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end
r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげ...