別のキーワード
ライブラリ
クラス
-
ARGF
. class (50) - Array (606)
- BasicObject (36)
- Binding (12)
- Complex (72)
- Data (3)
- Dir (130)
-
Encoding
:: Converter (24) - Enumerator (60)
-
Enumerator
:: Lazy (169) - Exception (104)
- Fiber (42)
- File (124)
-
File
:: Stat (12) - Float (45)
- FrozenError (6)
-
Gem
:: Installer (12) - Hash (68)
- IO (556)
-
IRB
:: ExtendCommand :: Load (12) - Integer (174)
- MatchData (102)
- Matrix (162)
- Module (324)
- Monitor (18)
- Mutex (4)
-
Net
:: HTTPResponse (12) - Numeric (93)
- Object (180)
-
OpenSSL
:: BN (216) - OptionParser (348)
- Pathname (36)
- Prime (12)
- Proc (48)
-
Rake
:: InvocationChain (12) - Random (48)
- Range (242)
- Rational (97)
- Regexp (12)
- Set (216)
- Socket (12)
- String (336)
- StringIO (304)
- StringScanner (60)
- Struct (36)
- Thread (60)
-
Thread
:: Mutex (20) - ThreadGroup (12)
- TracePoint (105)
- UnboundMethod (12)
- Vector (98)
- WIN32OLE (36)
-
WIN32OLE
_ TYPELIB (12)
モジュール
- Comparable (72)
- Enumerable (156)
- Kernel (12)
-
Net
:: HTTPHeader (72) -
OptionParser
:: Arguable (60) -
Rake
:: TaskManager (12) - TSort (35)
キーワード
- & (24)
- * (60)
- ** (13)
- + (24)
- - (24)
-
/ (12) - < (24)
- << (12)
- <= (24)
- <=> (12)
- == (24)
- === (24)
- =~ (24)
- > (24)
- >= (24)
- >> (12)
- [] (198)
- []= (146)
- ^ (12)
- accept (12)
- add (12)
- adjugate (12)
- advise (12)
-
angle
_ with (12) - antisymmetric? (7)
- append (12)
- at (12)
- atime (12)
- backtrace (12)
-
backtrace
_ locations (12) - begin (24)
- between? (12)
- bind (12)
- binmode (12)
- birthtime (12)
- bsearch (48)
- byteindex (3)
- byteoffset (6)
- bytes (14)
- call (12)
-
callee
_ id (12) - cause (12)
- ceil (12)
- children (19)
- chmod (12)
- chown (12)
- chr (24)
- chunk (12)
- clamp (12)
-
class
_ variable _ get (12) -
clear
_ bit! (12) - clone (24)
- close (16)
-
close
_ read (12) -
close
_ write (12) - cmp (12)
- coerce (24)
-
cofactor
_ expansion (12) - collect (12)
- collect2 (24)
-
collect
_ concat (12) - combination (24)
- connect (12)
-
const
_ get (12) -
const
_ missing (12) -
content
_ length (12) - convert (12)
- ctime (12)
- cycle (24)
-
define
_ method (24) -
delete
_ at (12) -
deprecate
_ constant (12) - det (12)
- detect (24)
- determinant (12)
- difference (12)
- digits (24)
- disjoint? (12)
- drop (12)
- dup (24)
- each (144)
-
each
_ byte (48) -
each
_ child (14) -
each
_ line (96) - eigen (12)
- eigensystem (12)
- end (24)
- entries (19)
-
entrywise
_ product (8) -
enum
_ for (48) - environment (12)
- eof (12)
- eof? (12)
-
eval
_ script (7) - event (12)
- exception (24)
- execute (12)
- exit (12)
- fcntl (12)
- fdatasync (12)
- feed (12)
- fetch (116)
-
fetch
_ values (20) - fileno (23)
- filter (7)
-
filter
_ map (6) - find (24)
-
find
_ all (12) - finish (12)
- first (48)
-
flat
_ map (12) - flatten (24)
- flatten! (24)
- flock (12)
- floor (12)
- flush (12)
- gcd (12)
- gcdlcm (12)
- gem (12)
- getbyte (12)
- getc (12)
- getopts (36)
- gets (12)
-
hadamard
_ product (8) - hstack (12)
- include (12)
-
initialize
_ copy (12) - insert (12)
- inspect (24)
- install (12)
-
instance
_ eval (24) -
instance
_ method (12) -
instruction
_ sequence (7) - intersection (18)
- isatty (12)
- join (12)
-
laplace
_ expansion (12) - last (48)
- lcm (12)
- lineno (12)
- lines (14)
-
local
_ variable _ get (12) - lshift! (12)
- lstat (12)
- map (12)
- map2 (12)
-
marshal
_ load (12) -
mask
_ bits! (12) - max (94)
- merge (12)
- method (12)
-
method
_ id (12) -
method
_ missing (12) - min (94)
-
mod
_ add (12) -
mod
_ exp (12) -
mod
_ inverse (12) -
mod
_ mul (12) -
mod
_ sub (12) -
mon
_ exit (6) - mtime (12)
- name= (10)
- next (12)
-
next
_ values (12) - normalize (12)
- offset (24)
-
ole
_ query _ interface (12) - on (144)
- ord (12)
- order (48)
- order! (48)
- overlap? (2)
- parameters (7)
- parse (24)
- parse! (24)
- path (32)
- peek (24)
-
peek
_ values (12) - peep (12)
- permutation (24)
- permute (24)
- permute! (24)
- pid (12)
- pointer= (12)
- pop (24)
- pos (24)
- pos= (48)
- pow (24)
- pread (8)
-
prime
_ division (24) -
prime
_ fasttest? (12) - print (36)
- printf (12)
- private (48)
-
private
_ constant (12) -
proper
_ subset? (12) -
proper
_ superset? (12) - public (48)
-
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ method (12) -
public
_ send (24) - putc (12)
- puts (12)
- pwrite (8)
- quo (12)
-
raised
_ exception (12) - rand (36)
- range (12)
-
range
_ length (12) - rationalize (24)
- read (12)
- readbyte (36)
- readchar (24)
- readline (12)
- readlines (48)
- receiver (6)
- regular? (12)
- rehash (12)
- reject (24)
-
relative
_ path _ from (12) -
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
remove
_ method (12) - reopen (60)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - replace (24)
-
report
_ on _ exception (9) -
report
_ on _ exception= (9) -
respond
_ to? (12) - resume (12)
-
return
_ value (12) -
reverse
_ each (4) - rewind (12)
- rotate (12)
- rotate! (12)
- round (33)
- rshift! (12)
- run (12)
- sample (48)
- seek (12)
- select (12)
-
set
_ backtrace (12) -
set
_ bit! (12) - setbyte (12)
- setproperty (24)
- shift (24)
-
singleton
_ class (12) -
singleton
_ method (12) - size (12)
-
skew
_ symmetric? (7) - sleep (12)
- slice (72)
- stat (12)
- step (103)
- subset? (12)
- subtract (12)
- superset? (12)
- sync (12)
- synchronize (12)
-
synthesize
_ file _ task (12) - syswrite (12)
- take (12)
- tell (24)
-
to
_ a (7) -
to
_ d (36) -
to
_ enum (48) -
to
_ f (12) -
to
_ i (36) -
to
_ path (8) -
to
_ r (12) -
to
_ s (24) - tr (12)
- trace (12)
- transfer (12)
- truncate (36)
- tsort (12)
-
tsort
_ each (23) - tty? (12)
- ucmp (12)
-
undef
_ method (12) - ungetc (12)
-
unicode
_ normalize (11) -
unicode
_ normalize! (11) -
unicode
_ normalized? (11) - union (12)
- unscan (12)
- value (12)
-
values
_ at (12) - wakeup (12)
- with (3)
- write (24)
- yield (12)
- zip (24)
- | (24)
検索結果
先頭5件
-
Fiber
# raise -> object (18128.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise Stop... -
Fiber
# raise(exception , message = nil , backtrace = nil) -> object (18128.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise Stop... -
Fiber
# raise(message) -> object (18128.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise Stop... -
TracePoint
# raised _ exception -> Exception (6125.0) -
発生した例外を返します。
...発生した例外を返します。
@raise RuntimeError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。
//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided... -
TracePoint
# instruction _ sequence -> RubyVM :: InstructionSequence (113.0) -
script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。
...イルされた
RubyVM::InstructionSequenceインスタンスを返します。
//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval("puts 'hello'")
end
//}
@raise RuntimeError :sc... -
Array
# []=(start , length , val) (51.0) -
インデックス start から length 個の要素を配列 val の内容で置き換えます。 start が自身の末尾を越える時には配列の長さを自動的に拡張し、拡張した領域を nil で初期化します。
...が自身の末尾を越える時には配列の長さを自動的に拡張し、拡張した領域を nil で初期化します。
//emlist[例][ruby]{
ary = [0, 1, 2, 3]
ary[1, 2] = ["a", "b", "c", "d"]
p ary #=> [0, "a", "b", "c", "d", 3]
ary = [0, 1, 2]
ary[5, 1] = "Z"......以外のオブジェクトを指定した場合は to_int メソッドに
よる暗黙の型変換を試みます。
//emlist[例][ruby]{
ary = [0, 1, 2, 3]
ary[1, 0] = ["inserted"]
p ary # => [0, "inserted", 1, 2, 3]
//}
@param val 設定したい要素を配......ます。
//emlist[例][ruby]{
a = [0, 1, 2, 3, 4, 5]
a[2, 3] = []
p a # => [0, 1, 5]
//}
@raise TypeError 引数 start、length に整数以外の(暗黙の型変換が行えな
い)オブジェクトを指定した場合に発生します。
@raise TypeError 引数 val に配... -
Enumerable
# chunk {|elt| . . . } -> Enumerator (49.0) -
要素を前から順にブロックで評価し、その結果によって 要素をチャンクに分けた(グループ化した)要素を持つ Enumerator を返します。
...//emlist[][ruby]{
enum.chunk {|elt| key }.each {|key, ary| do_something }
//}
例として、整数列を連続する奇数/偶数に分ける例を見てみます。
「n.even?」の値が切り替わるところで区切られているのがわかるでしょう。
//emlist[例][ruby]{
[3, 1, 4......ストを改行で区切って収めたものです。
大文字/小文字の違いを無視するため upcase しています。
//emlist[例][ruby]{
# ファイルのエンコーディングは実際のファイルに合わせてください。
open("/usr/share/dict/words", "r:iso-8859-1") {|f......釈されます。
それ以外のアンダースコアで始まるシンボルを指定した場合は例外が発生します。
//emlist[例][ruby]{
[1, 2].chunk { |item| :_underscore }.to_a
# => RuntimeError: symbols beginning with an underscore are reserved
# 「.to_a」無しだと Enumerat... -
Array
# []=(range , val) (41.0) -
Range オブジェクト range の範囲にある要素を配列 val の内容に置換します。 range の first が自身の末尾を越える時には配列の長さを自動的に拡張し、拡張した領域を nil で初期化します。
...が自身の末尾を越える時には配列の長さを自動的に拡張し、拡張した領域を nil で初期化します。
//emlist[例][ruby]{
ary = [0, 1, 2, 3, 4, 5]
ary[0..2] = ["a", "b"]
p ary # => ["a", "b", 3, 4, 5]
ary = [0, 1, 2]
ary[5..6] = "x"
p ary # => [0, 1, 2, nil, nil,......になります。
range の first が end より後にある場合には first の直前に val を挿入します。
//emlist[例][ruby]{
ary = [0, 1, 2, 3, 4, 5]
ary[2..0] = ["a", "b", "c"]
p ary # => [0, 1, "a", "b", "c", 2, 3, 4, 5]
//}
@param val range の範囲に設定した......要素が削除されます。
//emlist[例][ruby]{
ary = [0, 1, 2, 3, 4, 5]
ary[2..4] = []
p ary # => [0, 1, 5]
//}
@raise RangeError 指定された範囲の始点が自身の始点よりも前にある場合に発生します。
//emlist[例][ruby]{
a = [0, 1, 2, 3, 4, 5]
a[-10..10] = 1... -
IO
# advise(advice , offset=0 , len=0) -> nil (37.0) -
posix_fadvise(2) を呼びだし、 ファイルへのアクセスパターンをOSに知らせます。
...を指定するデータの長さ
@raise IOError ストリームが既に閉じられているときに発生する例外
@raise Errno::EBADF ファイルデスクリプタが不正であるときに発生する例外
@raise Errno::EINVAL advice が不正
@raise Errno::ESPIPE ファイルデスク......pipe を指している
場合に発生する例外(Linux はこの場合には Errno::EINVAL を発生する)
@raise RangeError offset,lenが有効範囲から出ている場合に発生する例外
//emlist[例][ruby]{
File.open("testfile") { |f| p f.advise(:sequential) } # => nil
//}... -
Net
:: HTTPHeader # fetch(key) -> String (37.0) -
key ヘッダフィールドを返します。
...されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。
//emlist[例 key のみ指定。key が存在する][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.......fetch("user-agent") # => "Ruby"
//}
//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'
begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri......l')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}
//emlist[例 key とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") {... -
Net
:: HTTPHeader # fetch(key) {|hash| . . . . } -> String (37.0) -
key ヘッダフィールドを返します。
...されていない時の返り値を指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。
//emlist[例 key のみ指定。key が存在する][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.......fetch("user-agent") # => "Ruby"
//}
//emlist[例 key のみ指定。key が存在しない][ruby]{
require 'net/http'
begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri......l')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") # => "default"
//}
//emlist[例 key とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") {...