ライブラリ
- ビルトイン (208)
- bigdecimal (6)
-
cgi
/ core (3) -
cgi
/ html (4) -
cgi
/ session (5) - csv (1)
- date (2)
- dbm (2)
- delegate (4)
- erb (2)
- fiddle (4)
-
fiddle
/ import (4) - gdbm (1)
- getoptlong (5)
-
irb
/ cmd / help (1) -
irb
/ context (2) -
irb
/ extend-command (1) -
irb
/ inspector (1) - json (5)
- matrix (34)
- mkmf (3)
- monitor (2)
-
net
/ imap (1) -
net
/ smtp (2) - openssl (31)
- optparse (11)
- ostruct (2)
- pathname (13)
- prime (9)
- pstore (4)
- psych (2)
- rake (3)
-
rdoc
/ markup (2) -
rdoc
/ parser / ruby (1) -
rdoc
/ top _ level (6) - resolv (1)
-
rexml
/ document (14) -
rexml
/ parsers / pullparser (1) -
ripper
/ filter (1) - rss (11)
-
rubygems
/ commands / update _ command (1) -
rubygems
/ dependency _ list (1) -
rubygems
/ installer (1) -
rubygems
/ specification (1) -
rubygems
/ validator (1) - sdbm (2)
- set (2)
- singleton (1)
- socket (4)
- stringio (3)
- tsort (2)
- un (1)
- uri (9)
-
webrick
/ httpauth / authenticator (2) -
webrick
/ httpresponse (1) -
webrick
/ httputils (3) -
webrick
/ log (1) -
win32
/ registry (4) - win32ole (1)
-
yaml
/ dbm (1) - zlib (5)
クラス
-
ARGF
. class (13) - Array (19)
- BasicObject (1)
- BigDecimal (6)
-
CGI
:: Session :: FileStore (1) -
CGI
:: Session :: NullStore (4) -
CSV
:: Table (1) - Complex (1)
- DBM (2)
- Date (2)
- Delegator (4)
- ERB (2)
-
Encoding
:: Converter (1) - Enumerator (6)
-
Enumerator
:: Lazy (33) -
Enumerator
:: Yielder (2) - Exception (1)
-
Fiddle
:: CStruct (2) -
Fiddle
:: Closure (1) -
Fiddle
:: Function (2) -
Fiddle
:: Pointer (1) - Float (2)
- GDBM (1)
-
Gem
:: Commands :: UpdateCommand (1) -
Gem
:: DependencyList (1) -
Gem
:: Installer (1) -
Gem
:: Specification (1) -
Gem
:: Validator (1) - GetoptLong (5)
- Hash (17)
- IO (11)
-
IRB
:: Context (2) -
IRB
:: ExtendCommand :: Help (1) -
IRB
:: Inspector (1) -
JSON
:: State (3) - MatchData (1)
- Matrix (17)
-
Matrix
:: EigenvalueDecomposition (7) -
Matrix
:: LUPDecomposition (3) - Module (12)
-
MonitorMixin
:: ConditionVariable (2) -
Net
:: IMAP (1) -
Net
:: SMTP (2) - Numeric (7)
- Object (7)
-
OpenSSL
:: BN (1) -
OpenSSL
:: OCSP :: Request (2) -
OpenSSL
:: PKey :: EC :: Group (6) -
OpenSSL
:: X509 :: Attribute (1) -
OpenSSL
:: X509 :: ExtensionFactory (8) -
OpenSSL
:: X509 :: Request (4) -
OpenSSL
:: X509 :: Store (3) -
OpenSSL
:: X509 :: StoreContext (5) - OpenStruct (2)
- OptionParser (10)
- PStore (4)
- Pathname (13)
- Prime (4)
-
Prime
:: PseudoPrimeGenerator (4) -
Prime
:: TrialDivisionGenerator (1) - Proc (1)
-
Process
:: Status (3) -
Psych
:: Visitors :: YAMLTree (2) -
RDoc
:: Markup (2) -
RDoc
:: Parser :: Ruby (1) -
RDoc
:: TopLevel (6) -
REXML
:: Attribute (2) -
REXML
:: Attributes (1) -
REXML
:: CData (1) -
REXML
:: Child (1) -
REXML
:: Element (2) -
REXML
:: Entity (1) -
REXML
:: Parent (4) -
REXML
:: Parsers :: PullParser (1) -
REXML
:: Text (2) -
RSS
:: Rss :: Channel :: Cloud (2) -
RSS
:: TaxonomyTopicModel :: TaxonomyTopic (2) -
RSS
:: TaxonomyTopicsModel :: TaxonomyTopics (1) -
Rake
:: DefaultLoader (1) -
Rake
:: TaskArguments (1) - Rational (3)
-
Resolv
:: DNS :: Resource :: IN :: WKS (1) -
Ripper
:: Filter (1) -
RubyVM
:: InstructionSequence (1) - SDBM (2)
- StopIteration (1)
- String (8)
- StringIO (3)
- Struct (2)
- Symbol (6)
- Thread (1)
-
Thread
:: Backtrace :: Location (1) -
Thread
:: Queue (1) - ThreadGroup (1)
- Time (1)
- TrueClass (1)
- UDPSocket (3)
- UNIXSocket (1)
-
URI
:: Generic (3) -
URI
:: MailTo (6) - UnboundMethod (1)
- Vector (7)
-
WEBrick
:: BasicLog (1) -
WEBrick
:: HTTPResponse (1) -
WEBrick
:: HTTPUtils :: FormData (3) - WIN32OLE (1)
-
Win32
:: Registry (4) -
YAML
:: DBM (1) -
Zlib
:: GzipReader (3) -
Zlib
:: GzipWriter (1) -
Zlib
:: ZStream (1)
モジュール
-
CGI
:: HtmlExtension (4) -
CGI
:: QueryExtension (1) -
CGI
:: QueryExtension :: Value (2) - DublinCoreModel (6)
- Enumerable (44)
-
Fiddle
:: Importer (2) -
IRB
:: ExtendCommandBundle (1) -
JSON
:: Generator :: GeneratorMethods :: String (1) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (1) - Kernel (4)
-
OpenSSL
:: Buffering (1) -
OptionParser
:: Arguable (1) -
Rake
:: TaskManager (1) - Singleton (1)
- TSort (2)
-
WEBrick
:: HTTPAuth :: Authenticator (2)
キーワード
- << (1)
- == (1)
- [] (1)
- []= (2)
- about (1)
- about= (1)
- absolute? (1)
-
absolute
_ path (1) -
add
_ class _ or _ module (1) -
add
_ html (1) -
add
_ namespace (2) -
add
_ special (1) - ancestors (1)
-
auto
_ indent _ mode (1) -
auto
_ indent _ mode= (1) - autoclose= (1)
- autoclose? (1)
- autoload (1)
- autoload? (1)
- autorequire= (1)
- bind (1)
-
buffer
_ initial _ length= (1) - bytes (1)
- call (1)
- casecmp (1)
- casecmp? (1)
- chars (1)
-
check
_ signedness (2) - children (1)
- chunk (3)
-
chunk
_ while (2) - chunked= (1)
- cleanup (1)
- clone (1)
- close (2)
- codepoints (1)
- cofactor (2)
-
cofactor
_ expansion (1) - collect (5)
- collect! (1)
- collect2 (1)
-
collect
_ concat (2) - column (1)
-
column
_ vectors (1) -
create
_ ext (1) -
create
_ extension (1) -
create
_ makefile (1) -
create
_ rule (1) -
current
_ cert (1) -
current
_ crl (1) - cycle (2)
-
dc
_ contributor (1) -
dc
_ contributor= (1) -
dc
_ contributors (1) -
dc
_ creator (1) -
dc
_ creator= (1) -
dc
_ creators (1) - debug (1)
-
default
_ proc= (1) - delete (1)
-
delete
_ if (5) - detect (1)
- drop (1)
-
drop
_ while (3) - dup (2)
- each (13)
-
each
_ byte (2) -
each
_ char (2) -
each
_ child (3) -
each
_ codepoint (1) -
each
_ cons (1) -
each
_ entry (1) -
each
_ grapheme _ cluster (2) -
each
_ index (1) -
each
_ line (9) -
each
_ pair (1) -
each
_ slice (1) -
each
_ strongly _ connected _ component (1) -
each
_ strongly _ connected _ component _ from (1) -
each
_ value (1) -
each
_ with _ index (3) -
each
_ with _ object (1) - eigen (1)
- eigensystem (1)
-
eigenvector
_ matrix (1) -
eigenvector
_ matrix _ inv (1) - eigenvectors (1)
-
enable
_ starttls _ auto (1) - enclose (1)
- entries (1)
-
enum
_ for (2) - executable? (1)
-
executable
_ real? (1) - execute (1)
- feed (1)
- fetch (1)
-
file
_ absolute _ name (1) -
file
_ absolute _ name= (1) - find (2)
-
find
_ all (2) -
find
_ index (3) -
find
_ local _ symbol (1) -
find
_ module _ named (1) -
flat
_ map (2) - force (1)
-
full
_ name (1) - generator (1)
- getopts (1)
-
grapheme
_ clusters (2) - grep (1)
-
grep
_ v (1) -
group
_ by (1) - headers (1)
- headers= (1)
- index (2)
-
inner
_ product (1) -
insert
_ output (1) - inspect (1)
-
inspect
_ value (1) -
install
_ alias _ method (1) -
instance
_ methods (1) -
issuer
_ certificate (1) -
issuer
_ certificate= (1) -
laplace
_ expansion (1) - lazy (2)
- lchown (1)
- lines (7)
- list (1)
- load (1)
- logger (1)
- lup (1)
-
lup
_ decomposition (1) - magnitude (1)
- map (5)
- map! (1)
-
marshal
_ dump (1) -
max
_ by (4) -
max
_ value _ length (1) -
max
_ value _ name _ length (1) - merge! (1)
-
min
_ by (2) -
minmax
_ by (1) - modulo (1)
- name (1)
-
next
_ values (1) - norm (1)
- normalize (1)
- normalize! (1)
-
num
_ bytes (1) -
num
_ keys (1) -
num
_ values (1) - numerator (3)
-
ok
_ to _ remove? (1) -
ole
_ query _ interface (1) -
on
_ default (1) - order! (2)
- owner (1)
- pack (2)
- parse (2)
- parse! (1)
- partition (1)
-
peek
_ values (1) - permutation (2)
- permute (2)
- permute! (1)
- prepended (1)
-
previous
_ sibling= (1) - prime? (1)
-
prime
_ division (1) - print (1)
-
private
_ instance _ methods (1) -
protected
_ instance _ methods (1) -
protected
_ methods (1) - protocol (2)
- protocol= (1)
-
public
_ instance _ methods (1) -
public
_ method (1) -
public
_ methods (1) - purpose= (2)
- push (1)
- putc (1)
- quiet (1)
- quiet= (1)
- quiet? (1)
-
quirks
_ mode= (1) - r (1)
- realm (1)
- reject (6)
- reject! (3)
-
repeated
_ permutation (1) - resources (1)
-
respond
_ to? (1) -
respond
_ to _ missing? (2) - restore (1)
- result (2)
-
reverse
_ each (1) - rewind (1)
- round (4)
- run (1)
- scan (1)
- select (5)
- select! (2)
- send (3)
-
send
_ io (1) -
server
_ protocol (1) -
set
_ default _ paths (1) -
set
_ generator (1) -
set
_ trace _ func (1) - setuid? (1)
-
singleton
_ class? (1) -
singleton
_ method _ undefined (1) -
singleton
_ methods (1) - size (1)
- slice (1)
-
slice
_ after (4) -
slice
_ before (5) -
slice
_ when (2) - solve (1)
-
sort
_ by (1) -
source
_ location (1) - start (1)
-
starttls
_ auto? (1) - step (7)
- stopped? (1)
- stopsig (1)
- store (3)
- struct (1)
-
subject
_ certificate (1) -
subject
_ certificate= (1) -
subject
_ request (1) -
subject
_ request= (1) - subsec (1)
- succ (2)
- summarize (2)
- take (1)
-
take
_ while (4) - terminated? (1)
- to= (1)
-
to
_ a (5) -
to
_ ary (4) -
to
_ binary (1) -
to
_ c (1) -
to
_ der (4) -
to
_ enum (2) -
to
_ h (2) -
to
_ i (3) -
to
_ json (2) -
to
_ mailtext (1) -
to
_ pem (2) -
to
_ ptr (1) -
to
_ rfc822text (1) -
to
_ s (5) -
to
_ set (2) -
to
_ string (1) -
to
_ text (2) -
to
_ value (1) -
total
_ out (1) - touch (1)
-
transform
_ values (2) -
transform
_ values! (2) - truncate (5)
- trust= (2)
-
uid
_ store (1) -
ultra
_ safe (1) -
ultra
_ safe= (1) - uniq (2)
- uniq! (2)
-
unit
_ test (1) - unlink (1)
- unpack (2)
- unshift (1)
- upcase (1)
- update (5)
-
upper
_ bound (1) - upto (2)
- v (1)
-
v
_ inv (1) - value (2)
- value= (1)
- values (2)
-
values
_ at (2) - verify (1)
- wait (1)
-
wait
_ until (1) -
which
_ to _ update (1) -
with
_ defaults (1) -
with
_ index (1) - write (1)
- yield (1)
-
yield
_ self (1) - zip (4)
検索結果
先頭5件
- URI
:: MailTo # to -> String - URI
:: MailTo # to _ mailtext -> String - RDoc
:: TopLevel # add _ class _ or _ module(collection , class _ type , name , superclass) -> RDoc :: NormalClass | RDoc :: SingleClass | RDoc :: NormalModule - Enumerator
:: Lazy # to _ enum(method = :each , *args) -> Enumerator :: Lazy - Enumerator
:: Lazy # to _ enum(method = :each , *args) {|*args| block} -> Enumerator :: Lazy
-
URI
:: MailTo # to -> String (81325.0) -
自身の e-mail アドレスを文字列で返します。
自身の e-mail アドレスを文字列で返します。
例:
require 'uri'
p URI.parse("mailto:nospam@example.com").to #=> "nospam@example.com" -
URI
:: MailTo # to _ mailtext -> String (63646.0) -
URI オブジェクトからメールテキスト文字列を生成します。
URI オブジェクトからメールテキスト文字列を生成します。
例:
require 'uri'
p mailto = URI.parse("mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr")
print mailto.to_mailtext
=> #<URI::MailTo:0x20104a0e URL:mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr>
To: ruby-list@ruby-lang.org
Sub... -
RDoc
:: TopLevel # add _ class _ or _ module(collection , class _ type , name , superclass) -> RDoc :: NormalClass | RDoc :: SingleClass | RDoc :: NormalModule (56104.0) -
collection に name で指定したクラス、モジュールを追加します。
collection に name で指定したクラス、モジュールを追加します。
@param collection クラス、モジュールを追加する先を Hash オブジェ
クトで指定します。
@param class_type 追加するクラス、モジュールを RDoc::NormalClass、
RDoc::SingleClass、RDoc::NormalModule オ
ブジェクトのいずれかで指定します。
@param name クラス名を文字列で指定します。
@param su... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) -> Enumerator :: Lazy (55630.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) ... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (55630.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) ... -
Matrix
# column _ vectors -> [Vector] (55204.0) -
自分自身を列ベクトルの配列として返します。
自分自身を列ベクトルの配列として返します。
//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]
p m.column_vectors # => [Vector[1, 10, -1], Vector[2, 15, -2], Vector[3, 20, 1.5]]
//} -
RDoc
:: TopLevel # find _ module _ named(name) -> RDoc :: NormalModule (55204.0) -
RDoc が収集したクラスの内、name で指定した名前のモジュールを返します。 見つからなかった場合は nil を返します。
RDoc が収集したクラスの内、name で指定した名前のモジュールを返します。
見つからなかった場合は nil を返します。
@param name モジュール名を文字列で指定します。 -
Fiddle
:: Pointer # to _ value -> object (54925.0) -
自身はヒープに確保された Ruby のオブジェクトを指すポインタであると仮定して、 自身が指すオブジェクトを返します。
自身はヒープに確保された Ruby のオブジェクトを指すポインタであると仮定して、
自身が指すオブジェクトを返します。
例:
require 'fiddle'
s = 'abc'
i = Fiddle.dlwrap(s)
cptr = Fiddle::Pointer.new(i)
p cptr.to_value #=> "abc" -
BasicObject
# singleton _ method _ undefined(name) -> object (54904.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
特異メソッドが Module#undef_method または
undef により未定義にされた時にインタプリタから呼び出されます。
通常のメソッドの未定義に対するフックには
Module#method_undefined を使います。
@param name 未定義にされたメソッド名が Symbol で渡されます。
//emlist[例][ruby]{
class Foo
def singleton_method_undefined(name)
puts "singleton method \"#{name}\" was undefined"
end
end
obj... -
IO
# autoclose=(bool) (54904.0) -
auto-close フラグを設定します。
auto-close フラグを設定します。
フラグが設定されているオブジェクトは
close時/GCでのファイナライザ呼出時にファイルデスクリプタを close します。
偽を設定すると close しません。
@param bool 真偽値でフラグを設定します
@see IO#autoclose?
f = open("/dev/null")
IO.for_fd(f.fileno)
# ...
f.gets # may cause Errno::EBADF
f = open("/dev/null")
IO.for_fd(f.fileno).auto... -
IO
# autoclose? -> bool (54904.0) -
auto-close フラグを返します。
auto-close フラグを返します。
//emlist[例][ruby]{
IO.open(IO.sysopen("testfile")) do |io|
io.autoclose? # => true
io.autoclose = false
io.autoclose? # => false
end
//}
@see IO#autoclose= -
Module
# autoload(const _ name , feature) -> nil (54904.0) -
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload する対象を置き換えます。
const_name が(autoloadではなく)既に定義されているときは何もしません。
@param const_name String または Symbol で指定します。
なお、const_name には、"::" 演算子を含めることはできません。
つまり、self の直下に定... -
Module
# autoload?(const _ name) -> String | nil (54904.0) -
autoload 定数がまだ定義されてない(ロードされていない) ときにそのパス名を返します。 また、ロード済みなら nil を返します。
autoload 定数がまだ定義されてない(ロードされていない) ときにそのパス名を返します。
また、ロード済みなら nil を返します。
@param const_name String または Symbol で指定します。
@see Kernel.#autoload?
//emlist[例][ruby]{
autoload :Date, 'date'
autoload?(:Date) # => "date"
Date
autoload?(:Date) # => nil
autoload?(:Foo) # => nil
//} -
Net
:: SMTP # enable _ starttls _ auto(context = Net :: SMTP . default _ ssl _ context) -> () (54904.0) -
その Net::SMTP オブジェクトがSTARTTLSが利用可能な場合 (つまりサーバがSTARTTLSを広告した場合)のみにSTARTTLSを利用する ように設定します。
その Net::SMTP オブジェクトがSTARTTLSが利用可能な場合
(つまりサーバがSTARTTLSを広告した場合)のみにSTARTTLSを利用する
ように設定します。
@see Net::SMTP#starttls?, Net::SMTP#starttls_auto?, Net::SMTP#enable_starttls_auto
@param context SSL接続で利用する OpenSSL::SSL::SSLContext
@see Net::SMTP#starttls?, Net::SMTP#starttls_auto?, Net::SMTP#enable_starttl... -
Net
:: SMTP # starttls _ auto? -> bool (54904.0) -
その Net::SMTP オブジェクトが利用可能な場合にのみにSTARTTLSを利用するならば 真を返します。
その Net::SMTP オブジェクトが利用可能な場合にのみにSTARTTLSを利用するならば
真を返します。
@see Net::SMTP#starttls?, Net::SMTP#starttls_always?, Net::SMTP#enable_starttls_auto -
Zlib
:: ZStream # total _ out -> Integer (54904.0) -
ストリームの出力したデータの総バイト数を返します。
ストリームの出力したデータの総バイト数を返します。 -
JSON
:: Generator :: GeneratorMethods :: TrueClass # to _ json(state _ or _ hash = nil) -> String (54625.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"true" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
true.to_json # => "true"
//} -
Module
# singleton _ class? -> bool (54604.0) -
self が特異クラスの場合に true を返します。そうでなければ false を返し ます。
self が特異クラスの場合に true を返します。そうでなければ false を返し
ます。
//emlist[例][ruby]{
class C
end
C.singleton_class? # => false
C.singleton_class.singleton_class? # => true
//} -
RDoc
:: TopLevel # file _ absolute _ name -> String (54604.0) -
自身が管理するファイルに関する絶対パスを文字列で返します。
自身が管理するファイルに関する絶対パスを文字列で返します。 -
RDoc
:: TopLevel # file _ absolute _ name=(val) (54604.0) -
自身が管理するファイルに関する絶対パスを文字列で設定します。
自身が管理するファイルに関する絶対パスを文字列で設定します。
@param val パスを文字列で指定します。 -
URI
:: MailTo # to _ rfc822text -> String (54346.0) -
URI オブジェクトからメールテキスト文字列を生成します。
URI オブジェクトからメールテキスト文字列を生成します。
例:
require 'uri'
p mailto = URI.parse("mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr")
print mailto.to_mailtext
=> #<URI::MailTo:0x20104a0e URL:mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr>
To: ruby-list@ruby-lang.org
Sub... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) -> Enumerator :: Lazy (46330.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) ... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (46330.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) ... -
OpenSSL
:: X509 :: StoreContext # current _ crl -> OpenSSL :: X509 :: CRL | nil (46204.0) -
直前に検証に利用した CRL のオブジェクトを返します。
直前に検証に利用した CRL のオブジェクトを返します。
証明書チェインの各証明書検証後
コールバック(OpenSSL::X509::Store#verify_callback=)呼び出しに
渡される StoreContext オブジェクトにこのメソッドを呼び出すと
直前に検証に利用した CRL オブジェクトを返します。 -
Enumerable
# chunk _ while {|elt _ before , elt _ after| . . . } -> Enumerator (45976.0) -
要素を前から順にブロックで評価し、その結果によって要素をチャンクに分け た(グループ化した)要素を持つEnumerator を返します。
要素を前から順にブロックで評価し、その結果によって要素をチャンクに分け
た(グループ化した)要素を持つEnumerator を返します。
隣り合う値をブロックパラメータ elt_before、elt_after に渡し、ブロックの
評価値が偽になる所でチャンクを区切ります。
ブロックは self の長さ - 1 回呼び出されます。
@return チャンクごとの配列をブロックパラメータに渡す Enumerator
を返します。eachメソッドは以下のように呼び出します。
//emlist{
enum.chunk_while { |elt_before, elt_af... -
WIN32OLE
# ole _ query _ interface(iid) -> WIN32OLE (45922.0) -
IID(インターフェイスID)を指定してオブジェクトの別のインターフェイスを 持つオブジェクトを取得します。
IID(インターフェイスID)を指定してオブジェクトの別のインターフェイスを
持つオブジェクトを取得します。
オブジェクトが複数のオートメーション用インターフェイスを持つ場合に、当
メソッドを利用して既定のインターフェイスとは異なるインターフェイスを取
得します。
@param iid 取得するインターフェイスのIIDを文字列で指定します。
@return iidパラメータで指定したインターフェイスを持つWIN32OLEオブジェクト
@raise WIN32OLERuntimeError 指定したIIDをオブジェクトが持たない場合に通知されます。
ie = WIN32OLE.n... -
Gem
:: Commands :: UpdateCommand # which _ to _ update(highest _ installed _ gems , gem _ names) -> Array (45907.0) -
更新が必要な Gem のリストを返します。
更新が必要な Gem のリストを返します。 -
CGI
:: HtmlExtension # image _ button(attributes) -> String (45904.0) -
タイプが image の input 要素を生成します。
タイプが image の input 要素を生成します。
@param attributes 属性をハッシュで指定します。
例:
image_button({ "SRC" => "url", "ALT" => "string" })
# <INPUT TYPE="image" SRC="url" ALT="string"> -
CGI
:: HtmlExtension # image _ button(src = "" , name = nil , alt = nil) -> String (45904.0) -
タイプが image の input 要素を生成します。
タイプが image の input 要素を生成します。
@param src src 属性の値を指定します。
@param name name 属性の値を指定します。
@param alt alt 属性の値を指定します。
例:
image_button("url")
# <INPUT TYPE="image" SRC="url">
image_button("url", "name", "string")
# <INPUT TYPE="image" SRC="url" NAME="name" ALT="string"> -
CGI
:: HtmlExtension # radio _ button(attributes) -> String (45904.0) -
タイプが radio である input 要素を生成します。
タイプが radio である input 要素を生成します。
@param attributes 属性をハッシュで指定します。
例:
radio_button({ "NAME" => "name", "VALUE" => "value", "ID" => "foo" })
# <INPUT TYPE="radio" NAME="name" VALUE="value" ID="foo"> -
CGI
:: HtmlExtension # radio _ button(name = "" , value = nil , checked = nil) -> String (45904.0) -
タイプが radio である input 要素を生成します。
タイプが radio である input 要素を生成します。
@param name name 属性の値を指定します。
@param value value 属性の値を指定します。
@param checked 真ならば checked 属性を設定します。
例:
radio_button("name", "value")
# <INPUT TYPE="radio" NAME="name" VALUE="value">
radio_button("name", "value", true)
# <INPUT TYPE="radio" NAME="name" ... -
Complex
# numerator -> Complex (45904.0) -
分子を返します。
分子を返します。
//emlist[例][ruby]{
Complex('1/2+2/3i').numerator # => (3+4i)
Complex(3).numerator # => (3+0i)
//}
@see Complex#denominator -
Enumerator
:: Lazy # chunk _ while {|elt _ before , elt _ after| . . . } -> Enumerator :: Lazy (45904.0) -
Enumerable#chunk_while と同じですが、Enumerator ではなく Enumerator::Lazy を返します。
Enumerable#chunk_while と同じですが、Enumerator ではなく Enumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。 -
Ripper
:: Filter # on _ default(event , token , data) -> object (45904.0) -
イベントハンドラが未定義のイベントが実行された場合に実行されるイベント ハンドラです。
イベントハンドラが未定義のイベントが実行された場合に実行されるイベント
ハンドラです。
@param event 実行されたイベントを :on_XXX 形式のシンボルで指定されます。
@param token 現在のトークンが指定されます。
@param data 前のイベントハンドラの戻り値です。最初のイベントの場合は
Ripper::Filter#parse の引数になります。
このメソッドの戻り値は次のイベントハンドラの data 引数に渡されます。
on_default をオーバライドしなかった場合は data 引数をそのまま返します。
@see R... -
Enumerator
# next _ values -> Array (45640.0) -
「次」のオブジェクトを配列で返します。
「次」のオブジェクトを配列で返します。
Enumerator#next とほぼ同様の挙動をします。終端まで到達した場合は
StopIteration 例外を発生させます。
このメソッドは、
yield
と
yield nil
を区別するために使えます。
next メソッドによる外部列挙の状態は他のイテレータメソッドによる
内部列挙には影響を与えません。
ただし、 IO#each_line のようにおおもとの列挙メカニズムが副作用を
伴っている場合には影響があり得ます。
//emlist[例: next と next_values の違いを][ruby]{
o = Object... -
Enumerator
# peek _ values -> Array (45622.0) -
Enumerator#next_values のように「次」のオブジェクトを 配列で返しますが、列挙状態を変化させません。
Enumerator#next_values のように「次」のオブジェクトを
配列で返しますが、列挙状態を変化させません。
Enumerator#next, Enumerator#next_values のように
現在までの列挙状態に応じて「次」のオブジェクトを返しますが、
next と異なり列挙状態を変更しません。
列挙が既に最後へ到達している場合は、StopIteration 例外を発生します。
このメソッドは Enumerator#next_values と同様
yield
と
yield nil
を区別するために使えます。
//emlist[例][ruby]{
o =... -
StopIteration
# result -> object (45622.0) -
この例外オブジェクトを発生させる原因となったメソッド等の返り値を返します。
この例外オブジェクトを発生させる原因となったメソッド等の返り値を返します。
object = Object.new
def object.each
yield :yield1
yield :yield2
:each_returned
end
enumerator = object.to_enum
p enumerator.next #=> :yield1
p enumerator.next #=> :yield2
begin
enumerator.next
rescue StopIteration => error
... -
CGI
:: QueryExtension # server _ protocol -> String (45604.0) -
ENV['SERVER_PROTOCOL'] を返します。
ENV['SERVER_PROTOCOL'] を返します。 -
Delegator
# marshal _ dump -> object (45604.0) -
シリアライゼーションをサポートするためにDelegator#__getobj__ が返すオブジェクトを返します。
シリアライゼーションをサポートするためにDelegator#__getobj__ が返すオブジェクトを返します。 -
Delegator
# public _ methods(all = true) -> [Symbol] (45604.0) -
そのオブジェクトが理解できる public メソッド名の一覧を返します。
そのオブジェクトが理解できる public メソッド名の一覧を返します。
@param all 偽を指定すると __getobj__ のスーパークラスで定義されたメソッドを除きます。
@see Object#public_methods -
DublinCoreModel
# dc _ contributor (45604.0) -
@todo
@todo -
DublinCoreModel
# dc _ contributor= (45604.0) -
@todo
@todo -
DublinCoreModel
# dc _ contributors (45604.0) -
@todo
@todo -
Float
# numerator -> Integer (45604.0) -
自身を Rational に変換した時の分子を返します。
自身を Rational に変換した時の分子を返します。
@return 分子を返します。
//emlist[例][ruby]{
2.0.numerator # => 2
0.5.numerator # => 1
//}
@see Float#denominator -
IRB
:: Inspector # inspect _ value(v) -> () (45604.0) -
ライブラリ内部で使用します。
ライブラリ内部で使用します。 -
Kernel
# touch -> () (45604.0) -
ファイルのアクセス時刻と修正時刻を現在の時刻に変更します。
ファイルのアクセス時刻と修正時刻を現在の時刻に変更します。
ruby -run -e touch -- [OPTION] FILE
-v 詳細表示
@see touch(1) -
MonitorMixin
:: ConditionVariable # wait _ until { . . . } -> () (45604.0) -
モニタのロックを開放し、現在のスレッドを ブロックで指定した条件を満たすまで停止します。
モニタのロックを開放し、現在のスレッドを
ブロックで指定した条件を満たすまで停止します。
MonitorMixin::ConditionVariable#signal や
MonitorMixin::ConditionVariable#broadcast で
スレッドが起こされると、ロックを取得し、ブロックを評価し
その結果によってこのメソッドから抜け処理を継続するか
再びロックを開放しスレッドを停止するかを決めます。
@see MonitorMixin::ConditionVariable#wait -
OpenSSL
:: X509 :: Store # set _ default _ paths -> nil (45604.0) -
システムに組込まれている証明書を読み込みます。
システムに組込まれている証明書を読み込みます。
@raise OpenSSL::X509::StoreError 読み込みに失敗した場合に発生します -
OpenSSL
:: X509 :: StoreContext # cleanup -> self (45604.0) -
このメソッドは使わないでください。
このメソッドは使わないでください。 -
PStore
# ultra _ safe -> bool (45604.0) -
真であれば、パフォーマンスと引き換えにファイル更新の衝突を避けることができます。 デフォルトは偽です。
真であれば、パフォーマンスと引き換えにファイル更新の衝突を避けることができます。
デフォルトは偽です。
このフラグの効果があるのは一部のプラットフォームだけです。
(e.g. all POSIX platforms: Linux, Mac OS X, FreeBSD, etc) -
PStore
# ultra _ safe=(flag) (45604.0) -
真をセットすると、パフォーマンスと引き換えにファイル更新の衝突を避けることができます。
真をセットすると、パフォーマンスと引き換えにファイル更新の衝突を避けることができます。
このフラグの効果があるのは一部のプラットフォームだけです。
(e.g. all POSIX platforms: Linux, Mac OS X, FreeBSD, etc)
@param flag 真偽値を指定します。 -
RDoc
:: TopLevel # full _ name -> String (45604.0) -
自身が管理するファイルの名前を返します。
自身が管理するファイルの名前を返します。 -
RSS
:: Rss :: Channel :: Cloud # protocol (45604.0) -
@todo
@todo -
RSS
:: Rss :: Channel :: Cloud # protocol= (45604.0) -
@todo
@todo -
Rational
# numerator -> Integer (45604.0) -
分子を返します。
分子を返します。
@return 分子を返します。
//emlist[例][ruby]{
Rational(7).numerator # => 7
Rational(7, 1).numerator # => 7
Rational(9, -4).numerator # => -9
Rational(-2, -10).numerator # => 1
//}
@see Rational#denominator -
Resolv
:: DNS :: Resource :: IN :: WKS # protocol -> Integer (45604.0) -
IPプロトコル番号を返します。
IPプロトコル番号を返します。
例えば 6 は TCP に対応します。 -
URI
:: MailTo # to=(s) (45325.0) -
自身の e-mail アドレスを文字列で設定します。
自身の e-mail アドレスを文字列で設定します。
@param s 自身の e-mail アドレスを文字列で指定します。
@raise URI::InvalidComponentError 不正な引数 s に対して発生します。
例:
require 'uri'
m = URI.parse("mailto:nospam@example.com")
m.to = "nospaaaam@example.com"
p m #=> #<URI::MailTo:0xb7bf0614 URL:mailt... -
CGI
:: QueryExtension :: Value # to _ a -> Array (45310.0) -
@todo
@todo -
CGI
:: QueryExtension :: Value # to _ ary -> Array (45310.0) -
@todo
@todo -
CGI
:: Session :: NullStore # restore -> Hash (45304.0) -
セッションの状態を復元したハッシュを返します。 このクラスでは何もしません。
セッションの状態を復元したハッシュを返します。
このクラスでは何もしません。 -
Enumerator
:: Lazy # lazy -> self (45304.0) -
self を返します。
self を返します。
//emlist[例][ruby]{
lazy = (100..Float::INFINITY).lazy
p lazy.lazy # => #<Enumerator::Lazy: 100..Infinity>
p lazy == lazy.lazy # => true
//} -
Enumerator
:: Yielder # yield(*object) -> () (45304.0) -
Enumerator.new で使うメソッドです。
Enumerator.new で使うメソッドです。
生成された Enumerator オブジェクトの each メソッドを呼ぶと
Enumerator::Yielder オブジェクトが渡されたブロックが実行され、
ブロック内の yield メソッドが呼ばれるたびに each に渡された
ブロックが yield メソッドに渡された値とともに繰り返されます。
//emlist[例][ruby]{
enum = Enumerator.new do |y|
y.yield 1, 2, 3
end
enum.each do |x, y, z|
p [x, y, z]
end
# => [... -
RSS
:: TaxonomyTopicModel :: TaxonomyTopic # about (45304.0) -
@todo
@todo -
RSS
:: TaxonomyTopicModel :: TaxonomyTopic # about= (45304.0) -
@todo
@todo -
RSS
:: TaxonomyTopicsModel :: TaxonomyTopics # resources (45304.0) -
@todo
@todo -
WEBrick
:: HTTPAuth :: Authenticator # logger -> object (45304.0) -
ロガーオブジェクトを返します。
ロガーオブジェクトを返します。 -
WEBrick
:: HTTPAuth :: Authenticator # realm -> String (45304.0) -
レルムを返します。
レルムを返します。 -
Matrix
# lup -> Matrix :: LUPDecomposition (37402.0) -
行列の LUP 分解を保持したオブジェクトを返します。
行列の LUP 分解を保持したオブジェクトを返します。
Matrix::LUPDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(下三角行列、上三角行列、置換行列)
を得ることができます。これを [L, U, P] と書くと、
L*U = P*self を満たします。
//emlist[例][ruby]{
require 'matrix'
a = Matrix[[1, 2], [3, 4]]
l, u, p = a.lup
l.lower_triangular? # => true
u.upper_triangular? # => true
p.... -
Matrix
# lup _ decomposition -> Matrix :: LUPDecomposition (37402.0) -
行列の LUP 分解を保持したオブジェクトを返します。
行列の LUP 分解を保持したオブジェクトを返します。
Matrix::LUPDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(下三角行列、上三角行列、置換行列)
を得ることができます。これを [L, U, P] と書くと、
L*U = P*self を満たします。
//emlist[例][ruby]{
require 'matrix'
a = Matrix[[1, 2], [3, 4]]
l, u, p = a.lup
l.lower_triangular? # => true
u.upper_triangular? # => true
p.... -
String
# each _ grapheme _ cluster {|grapheme _ cluster| block } -> self (37276.0) -
文字列の書記素クラスタに対して繰り返します。
文字列の書記素クラスタに対して繰り返します。
String#each_char と違って、
Unicode Standard Annex #29 (https://unicode.org/reports/tr29/)
で定義された書記素クラスタに対して繰り返します。
//emlist[例][ruby]{
"a\u0300".each_char.to_a.size # => 2
"a\u0300".each_grapheme_cluster.to_a.size # => 1
//}
@see String#grapheme_clusters -
String
# grapheme _ clusters {|grapheme _ cluster| block } -> self (37270.0) -
文字列の書記素クラスタの配列を返します。(self.each_grapheme_cluster.to_a と同じです)
文字列の書記素クラスタの配列を返します。(self.each_grapheme_cluster.to_a と同じです)
//emlist[例][ruby]{
"a\u0300".grapheme_clusters # => ["à"]
//}
ブロックが指定された場合は String#each_grapheme_cluster と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_grapheme_cluster -
Rake
:: TaskArguments # with _ defaults(defaults) -> Hash (37240.0) -
パラメータにデフォルト値をセットします。
パラメータにデフォルト値をセットします。
@param defaults デフォルト値として使用するキーと値を格納したハッシュを指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
arguments = Rake::TaskArguments.new(["name1", "name2"], ["value1", "value2"])
arguments.to_hash ... -
Enumerator
:: Lazy # flat _ map {|item| . . . } -> Enumerator :: Lazy (37222.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
ブロックの実行結果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した値 x は、以下の場合にのみ分解され、連結されます。
* x が配列であるか、to_ary メソッドを持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) ... -
Hash
# transform _ values {|value| . . . } -> Hash (37222.0) -
すべての値に対してブロックを呼び出した結果で置き換えたハッシュを返します。 キーは変化しません。
すべての値に対してブロックを呼び出した結果で置き換えたハッシュを返します。
キーは変化しません。
@return 置き換えたハッシュを返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transform_values(&:to_s) #=> { a: "1", b: "2", ... -
Hash
# transform _ values! {|value| . . . } -> self (37222.0) -
すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。 キーは変化しません。
すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。
キーは変化しません。
@return transform_values! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values! {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transform_values!(&:to_s) #=> ... -
Object
# singleton _ methods(inherited _ too = true) -> [Symbol] (37204.0) -
そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。
そのオブジェクトに対して定義されている特異メソッド名
(public あるいは protected メソッド) の一覧を返します。
inherited_too が真のときは継承した特異メソッドを含みます。
継承した特異メソッドとは Object#extend によって追加された特異メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタンスの特異メソッド)などです。
singleton_methods(false) は、Object#methods(false) と同じです。
@param inherited_too 継承した特異メソッドを含める場合は... -
OpenSSL
:: PKey :: EC :: Group # set _ generator(generator , order , cofactor) -> self (37204.0) -
群のパラメータを設定します。
群のパラメータを設定します。
@param generator 生成元(OpenSSL::PKey::EC::Point オブジェクト)
@param order 生成元の位数(OpenSSL::BN オブジェクト)
@param cofactor 余因子OpenSSL::BN オブジェクト
@raise OpenSSL::PKey::EC::Group::Error 設定に失敗した場合に発生します -
Encoding
:: Converter # insert _ output(string) -> nil (36976.0) -
変換器内のバッファに文字列を挿入します。 バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。
変換器内のバッファに文字列を挿入します。
バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。
変換先がステートフルなエンコーディングであった場合、
挿入された文字列は状態に基づいて変換され、状態を更新します。
このメソッドは変換に際してエラーが発生した際にのみ利用されるべきです。
@param string 挿入する文字列
//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
src = "HIRAGANA LETTER A is \u{3042}."
dst = ""
p ec.... -
String
# each _ grapheme _ cluster -> Enumerator (36976.0) -
文字列の書記素クラスタに対して繰り返します。
文字列の書記素クラスタに対して繰り返します。
String#each_char と違って、
Unicode Standard Annex #29 (https://unicode.org/reports/tr29/)
で定義された書記素クラスタに対して繰り返します。
//emlist[例][ruby]{
"a\u0300".each_char.to_a.size # => 2
"a\u0300".each_grapheme_cluster.to_a.size # => 1
//}
@see String#grapheme_clusters -
Exception
# full _ message(highlight: true , order: :bottom) -> String (36958.0) -
例外の整形された文字列を返します。
例外の整形された文字列を返します。
返される文字列は Ruby が捕捉されなかった例外を標準エラー出力に出力するときと
同じ形式です。
そのため、メソッド呼び出し時に $stderr が変更されておらず、$stderr.tty? が真の場合は
エスケープシーケンスによる文字装飾がついています。
[注意] このメソッドは実験的な機能として提供されています。仕様が変更に
なる可能性があります。
そして実際に、キーワード引数 highlight と order は 2.5.1 で追加されました。
@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。... -
Enumerator
:: Lazy # collect _ concat {|item| . . . } -> Enumerator :: Lazy (36922.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
ブロックの実行結果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した値 x は、以下の場合にのみ分解され、連結されます。
* x が配列であるか、to_ary メソッドを持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) ... -
Hash
# transform _ values -> Enumerator (36922.0) -
すべての値に対してブロックを呼び出した結果で置き換えたハッシュを返します。 キーは変化しません。
すべての値に対してブロックを呼び出した結果で置き換えたハッシュを返します。
キーは変化しません。
@return 置き換えたハッシュを返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transform_values(&:to_s) #=> { a: "1", b: "2", ... -
Hash
# transform _ values! -> Enumerator (36922.0) -
すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。 キーは変化しません。
すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。
キーは変化しません。
@return transform_values! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values! {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transform_values!(&:to_s) #=> ... -
Delegator
# respond _ to _ missing?(m , include _ private) -> bool (36907.0) -
@param m メソッド名を指定します。
@param m メソッド名を指定します。
@param include_private 真を指定すると private メソッドも調べます。 -
Array
# values _ at(*selectors) -> Array (36904.0) -
引数で指定されたインデックスに対応する要素を配列で返します。インデッ クスに対応する値がなければ nil が要素になります。
引数で指定されたインデックスに対応する要素を配列で返します。インデッ
クスに対応する値がなければ nil が要素になります。
@param selectors インデックスを整数もしくは整数の Range で指定します。
//emlist[例][ruby]{
ary = %w( a b c d e )
p ary.values_at( 0, 2, 4 ) #=> ["a", "c", "e"]
p ary.values_at( 3, 4, 5, 6, 35 ) #=> ["d", "e", nil, nil, nil]
p ary.values_at( 0, -1,... -
Date
# upto(max) {|date| . . . } -> self (36904.0) -
このメソッドは、step(max, 1){|date| ...} と等価です。
このメソッドは、step(max, 1){|date| ...} と等価です。
@param max 日付オブジェクト
@see Date#step, Date#downto -
ERB
# result(b=TOPLEVEL _ BINDING) -> String (36904.0) -
ERB を b の binding で実行し、結果の文字列を返します。
ERB を b の binding で実行し、結果の文字列を返します。
@param b eRubyスクリプトが実行されるときのbinding
//emlist[例][ruby]{
require 'erb'
erb = ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
test1 = "foo"
test2 = "bar"
puts erb.result
# test foo
# test bar
//}
@see ERB#result_with_hash -
Enumerable
# collect -> Enumerator (36904.0) -
各要素に対してブロックを評価した結果を全て含む配列を返します。
各要素に対してブロックを評価した結果を全て含む配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# すべて 3 倍にした配列を返す
p (1..3).map {|n| n * 3 } # => [3, 6, 9]
p (1..3).collect { "cat" } # => ["cat", "cat", "cat"]
//}
@see Array#collect, Array#map -
Enumerable
# collect _ concat -> Enumerator (36904.0) -
各要素をブロックに渡し、その返り値を連結した配列を返します。
各要素をブロックに渡し、その返り値を連結した配列を返します。
ブロックの返り値は基本的に配列を返すべきです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[[1,2], [3,4]].flat_map{|i| i.map{|j| j*2}} # => [2,4,6,8]
//} -
Enumerable
# cycle(n=nil) -> Enumerator (36904.0) -
Enumerable オブジェクトの各要素を n 回 or 無限回(n=nil)繰り返し ブロックを呼びだします。
Enumerable オブジェクトの各要素を n 回 or 無限回(n=nil)繰り返し
ブロックを呼びだします。
n に 0 もしくは負の値を渡した場合は何もしません。
繰り返しが最後まで終了した場合(つまりbreakなどで中断しなかった場合)
は nil を返します。
このメソッドは内部の配列に各要素を保存しておくため、
一度 Enumerable の終端に到達した後に自分自身を変更しても
このメソッドの動作に影響を与えません。
//emlist[例][ruby]{
a = ["a", "b", "c"]
a.cycle {|x| puts x } # print, a, b, c,... -
Enumerable
# drop _ while -> Enumerator (36904.0) -
ブロックを評価して最初に偽となった要素の手前の要素まで捨て、 残りの要素を配列として返します。
ブロックを評価して最初に偽となった要素の手前の要素まで捨て、
残りの要素を配列として返します。
ブロックを指定しなかった場合は、Enumerator を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
//} -
Enumerable
# flat _ map -> Enumerator (36904.0) -
各要素をブロックに渡し、その返り値を連結した配列を返します。
各要素をブロックに渡し、その返り値を連結した配列を返します。
ブロックの返り値は基本的に配列を返すべきです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[[1,2], [3,4]].flat_map{|i| i.map{|j| j*2}} # => [2,4,6,8]
//} -
Enumerable
# take _ while -> Enumerator (36904.0) -
Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。
Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。
//emlist[例][ruby]{
e = [1, 2, 3, 4, 5, 0].each
e.take_while {|i| i < 3 } # => [1, 2]
//}
ブロックを省略した場合は Enumerator を返します。
@see Array#take_while -
Enumerator
:: Lazy # chunk {|elt| . . . } -> Enumerator :: Lazy (36904.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # chunk(initial _ state) {|elt , state| . . . } -> Enumerator :: Lazy (36904.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # collect {|item| . . . } -> Enumerator :: Lazy (36904.0) -
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.map{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:map>
1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8,... -
Enumerator
:: Lazy # drop _ while {|item| . . . } -> Enumerator :: Lazy (36904.0) -
Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.drop_while { |i| i < 42 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop_while>
1.step.lazy.drop_while { |i| i < 42 }.take(10).force
# => [42, 43, 44, 45, 46, 47, 48, 49, 50, 51]
//... -
Enumerator
:: Lazy # find _ all {|item| . . . } -> Enumerator :: Lazy (36904.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # select {|item| . . . } -> Enumerator :: Lazy (36904.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # slice _ after {|elt| bool } -> Enumerator :: Lazy (36904.0) -
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>
1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force
# => [[1, 2, 3], [4, 5, 6], [...