ライブラリ
- ビルトイン (4033)
クラス
- Array (54)
- BasicObject (143)
- Binding (11)
- Class (22)
- Data (22)
- Dir (11)
-
Encoding
:: Converter (176) -
Encoding
:: InvalidByteSequenceError (22) -
Encoding
:: UndefinedConversionError (11) - Enumerator (132)
-
Enumerator
:: Yielder (27) - Exception (22)
- Fiber (32)
- File (21)
-
File
:: Stat (429) - Hash (127)
- IO (422)
- KeyError (14)
- LocalJumpError (22)
- Method (182)
- Module (254)
- Mutex (12)
- NameError (9)
- Numeric (11)
- Object (391)
-
ObjectSpace
:: WeakMap (11) - Proc (33)
- Random (88)
- Range (34)
- Regexp (66)
- StopIteration (11)
- String (22)
- Struct (258)
- SystemExit (11)
- Thread (324)
-
Thread
:: Backtrace :: Location (44) -
Thread
:: ConditionVariable (18) -
Thread
:: Mutex (54) -
Thread
:: Queue (90) -
Thread
:: SizedQueue (54) - ThreadGroup (33)
- Time (22)
- TracePoint (128)
- UnboundMethod (21)
モジュール
- Enumerable (132)
キーワード
- ! (11)
- != (11)
- < (11)
- << (11)
- <=> (33)
- == (79)
- === (29)
- [] (44)
- []= (22)
-
_ _ id _ _ (11) -
_ _ send _ _ (22) -
_ dump (11) -
abort
_ on _ exception (11) -
abort
_ on _ exception= (11) -
absolute
_ path (11) - add (11)
-
add
_ trace _ func (11) -
alias
_ method (11) - alive? (14)
- allocate (11)
- arity (11)
- atime (11)
- backtrace (11)
-
backtrace
_ locations (33) -
base
_ label (11) - bind (11)
-
bind
_ call (10) - binding (11)
- birthtime (10)
- blksize (11)
- blockdev? (11)
- blocks (11)
- broadcast (9)
- bytes (11)
- call (22)
-
callee
_ id (11) - casefold? (11)
- chardev? (11)
- chmod (11)
-
class
_ eval (22) -
class
_ exec (11) -
class
_ variable _ set (11) - clear (20)
- clone (11)
- close (29)
- closed? (20)
- coerce (11)
- convert (11)
- convpath (11)
- ctime (11)
- deconstruct (2)
-
deconstruct
_ keys (2) - default (22)
-
default
_ proc (11) -
define
_ method (22) -
defined
_ class (11) - deq (18)
-
destination
_ encoding (11) - dev (11)
-
dev
_ major (11) -
dev
_ minor (11) - dig (9)
- directory? (11)
- display (11)
- each (132)
-
each
_ char (22) -
each
_ entry (22) -
each
_ line (66) -
each
_ pair (22) -
each
_ with _ index (22) - empty? (9)
- enclose (11)
- enclosed? (11)
- entries (6)
-
enum
_ for (22) - eof (11)
- eof? (11)
- eql? (35)
- equal? (11)
-
error
_ bytes (11) -
error
_ char (11) -
eval
_ script (6) - event (11)
- executable? (11)
-
executable
_ real? (11) - exit (11)
-
exit
_ value (11) - extend (11)
- extended (11)
- feed (11)
- fetch (7)
- file? (11)
- filter (12)
- finish (11)
- ftype (11)
- getbyte (11)
- getc (11)
- gets (33)
- gid (11)
- grpowned? (11)
- hash (13)
-
ignore
_ deadlock= (3) -
incomplete
_ input? (11) - initialize (11)
-
initialize
_ copy (11) - ino (11)
-
insert
_ output (11) - inspect (90)
-
instance
_ eval (22) -
instance
_ exec (11) -
instance
_ method (11) -
instance
_ of? (11) -
instance
_ variable _ defined? (11) -
instance
_ variable _ get (11) -
instance
_ variable _ set (11) -
instance
_ variables (11) -
instruction
_ sequence (6) -
is
_ a? (11) - isatty (11)
- join (22)
- key (7)
- kill (11)
-
kind
_ of? (11) - lambda? (11)
-
last
_ error (11) - length (20)
- lineno (22)
- lineno= (11)
-
local
_ variable _ set (11) - locked? (11)
-
marshal
_ dump (22) -
marshal
_ load (11) - match (22)
- max (53)
- max= (9)
- members (13)
- merge (22)
-
method
_ id (11) -
method
_ missing (11) - methods (11)
- min (44)
- mode (11)
-
module
_ eval (22) -
module
_ exec (11) - mtime (11)
- name (22)
- name= (9)
-
next
_ values (11) - nlink (11)
-
num
_ waiting (9) -
original
_ name (11) - owned? (22)
- owner (11)
- pack (16)
- parameters (17)
- path (13)
-
peek
_ values (11) - pipe? (11)
- pop (18)
- prepend (11)
-
primitive
_ convert (44) -
primitive
_ errinfo (11) - priority (11)
- priority= (11)
- private (23)
- putback (22)
- raise (26)
-
raised
_ exception (11) - rand (33)
- rdev (11)
-
rdev
_ major (11) -
rdev
_ minor (11) - readable? (11)
-
readable
_ real? (11) - readchar (11)
- readline (33)
- reason (11)
- receiver (27)
- refine (11)
-
remove
_ instance _ variable (11) - reopen (33)
- replace (11)
- replacement (11)
- replacement= (11)
-
report
_ on _ exception (8) -
report
_ on _ exception= (8) -
respond
_ to? (11) -
respond
_ to _ missing? (11) - result (11)
- resume (11)
-
return
_ value (11) - rewind (11)
- run (11)
-
safe
_ level (7) - seed (11)
- seek (11)
- select (22)
- send (22)
-
set
_ trace _ func (11) - setgid? (11)
- setuid? (11)
- shift (29)
- shuffle (22)
- signal (9)
-
singleton
_ class (11) -
singleton
_ method (11) -
singleton
_ method _ added (11) -
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) - size (42)
- size? (11)
- sleep (11)
- socket? (11)
-
source
_ encoding (11) -
source
_ location (11) - status (22)
- sticky? (11)
- stop? (11)
- strftime (11)
- sum (16)
-
super
_ method (10) - symlink? (11)
- sync= (11)
- synchronize (11)
- tainted? (6)
- terminate (11)
-
thread
_ variable _ get (11) -
thread
_ variable _ set (11) -
to
_ a (17) -
to
_ ary (11) -
to
_ enum (22) -
to
_ h (38) -
to
_ hash (11) -
to
_ int (11) -
to
_ path (2) -
to
_ proc (27) -
to
_ regexp (11) -
to
_ s (75) -
to
_ str (11) - transfer (3)
-
try
_ lock (11) - tty? (11)
- uid (11)
- unbind (11)
-
undef
_ method (11) - ungetbyte (11)
- ungetc (11)
- unlock (11)
- value (11)
- values (11)
-
values
_ at (22) - wakeup (11)
- wday (11)
- with (2)
-
with
_ index (22) -
with
_ object (22) - writable? (11)
-
writable
_ real? (11) - yield (11)
- zero? (11)
検索結果
先頭5件
-
Enumerable
# min(n) {|a , b| . . . } -> Array (8055.0) -
ブロックの評価結果で各要素の大小判定を行い、最小の要素、もしくは最小の n 要素が昇順で入った配列を返します。 引数を指定しない形式では要素が存在しなければ nil を返します。 引数を指定する形式では、空の配列を返します。
...ge = age
end
end
people = [
Person.new("sato", 55),
Person.new("sato", 33),
Person.new("sato", 11),
Person.new("suzuki", 55),
Person.new("suzuki", 33),
Person.new("suzuki", 11),
Person.new("tanaka", 55),
Person.new("tanaka", 33),
Person.new("tanaka", 11)
]
# 年齢が最小、... -
Proc
# lambda? -> bool (8055.0) -
手続きオブジェクトの引数の取扱が厳密であるならば true を返します。
...bda{}.lambda? # => true
# proc で生成した Proc オブジェクトでは false
proc{}.lambda? # => false
# Proc.new で生成した Proc オブジェクトでは false
Proc.new{}.lambda? # => false
# 以下、lambda?が偽である場合
# 余分な引数を無視する
proc{|a,b| [a,b]}.call......{}).lambda? #=> true
Proc.new(&lambda {}).lambda? #=> true
lambda(&proc {}).lambda? #=> false
proc(&proc {}).lambda? #=> false
Proc.new(&proc {}).lambda? #=> false
n(&lambda {}) #=> true
n(&proc {}) #=> false
n(&Proc.new {}) #=> false
#......ソッドの引数は常に厳密に取り扱われる
class C
define_method(:d) {}
end
C.new.d(1,2) #=> ArgumentError
C.new.method(:d).to_proc.lambda? #=> true
class C
define_method(:e, &proc {})
end
C.new.e(1,2) #=> ArgumentError
C.new.method(:e).to_proc.lambda? #=> true
//}... -
Random
# rand -> Float (8055.0) -
一様な擬似乱数を発生させます。
...が存在しない範囲を渡した時などに発生します。
//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0.1915194503788923
# max に実数も指定出来る
prng......る
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand......3.6148130397862865
# 2012年のすべての時刻から一つ選ばれる
# Time#- は秒数を float で返すため。
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
# DateTime ではうまくいかない。というのは DateTime#- は
# Rational を返す... -
Random
# rand(max) -> Integer | Float (8055.0) -
一様な擬似乱数を発生させます。
...が存在しない範囲を渡した時などに発生します。
//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0.1915194503788923
# max に実数も指定出来る
prng......る
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand......3.6148130397862865
# 2012年のすべての時刻から一つ選ばれる
# Time#- は秒数を float で返すため。
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
# DateTime ではうまくいかない。というのは DateTime#- は
# Rational を返す... -
Random
# rand(range) -> Integer | Float (8055.0) -
一様な擬似乱数を発生させます。
...が存在しない範囲を渡した時などに発生します。
//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0.1915194503788923
# max に実数も指定出来る
prng......る
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand......3.6148130397862865
# 2012年のすべての時刻から一つ選ばれる
# Time#- は秒数を float で返すため。
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
# DateTime ではうまくいかない。というのは DateTime#- は
# Rational を返す... -
Regexp
# options -> Integer (8049.0) -
正規表現の生成時に指定されたオプションを返します。戻り値は、 Regexp::EXTENDED, Regexp::IGNORECASE, Regexp::MULTILINE, Regexp::FIXEDENCODING, Regexp::NOENCODING, の論理和です。
...るもので、Regexp.new にこれらを
渡しても無視されます。
//emlist[例][ruby]{
p Regexp::IGNORECASE # => 1
p //i.options # => 1
p Regexp.new("foo", Regexp::IGNORECASE ).options # => 1
p Regexp.new("foo", Regexp::EXTENDED).options # => 2
p Regexp.new("foo", Regexp::IGNOR......ASE | Regexp::EXTENDED).options # => 3
p Regexp.new("foo", Regexp::MULTILINE).options # => 4
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE ).options # => 5
p Regexp.new("foo", Regexp::MULTILINE | Regexp::EXTENDED).options # =>6
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE... -
Time
# wday -> Integer (8043.0) -
曜日を0(日曜日)から6(土曜日)の整数で返します。
...= Time.new(2017, 9, 17, 10, 34, 15, '+09:00') # => 2017-09-17 10:34:15 +0900
p sun.wday # => 0
p mon = Time.new(2017, 9, 18, 10, 34, 15, '+09:00') # => 2017-09-18 10:34:15 +0900
p mon.wday # => 1
p tue = Time.new(2017,......= Time.new(2017, 9, 20, 10, 34, 15, '+09:00') # => 2017-09-20 10:34:15 +0900
p wed.wday # => 3
p thu = Time.new(2017, 9, 21, 10, 34, 15, '+09:00') # => 2017-09-21 10:34:15 +0900
p thu.wday # => 4
p fri = Time.new(2017,......9, 22, 10, 34, 15, '+09:00') # => 2017-09-22 10:34:15 +0900
p fri.wday # => 5
p sat = Time.new(2017, 9, 23, 10, 34, 15, '+09:00') # => 2017-09-23 10:34:15 +0900
p sat.wday # => 6
//}... -
Encoding
:: Converter # primitive _ errinfo -> Array (8037.0) -
直前の Encoding::Converter#primitive_convert による変換の結果を保持する五要素の配列を返します。
...ることはできますが、有用な使い方は難しいでしょう。
//emlist[][ruby]{
# \xff is invalid as EUC-JP.
ec = Encoding::Converter.new("EUC-JP", "Shift_JIS")
ec.primitive_convert(src="\xff", dst="", nil, 10)
p ec.primitive_errinfo
#=> [:invalid_byte_sequence, "EUC-JP", "Shift_JIS",......\x82).
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
ec.primitive_convert(src="\xa4\xa2", dst="", nil, 10)
p ec.primitive_errinfo
#=> [:undefined_conversion, "UTF-8", "ISO-8859-1", "\xE3\x81\x82", ""]
# partial character is invalid
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
ec.prim......nput, "EUC-JP", "UTF-8", "\xA4", ""]
# Encoding::Converter::PARTIAL_INPUT prevents invalid errors by
# partial characters.
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
ec.primitive_convert(src="\xa4", dst="", nil, 10, Encoding::Converter::PARTIAL_INPUT)
p ec.primitive_errinfo
#=> [:source_b... -
ThreadGroup
# enclose -> self (8037.0) -
自身への ThreadGroup#add によるスレッドの追加・削除を禁止します。 enclose された ThreadGroup に追加や削除を行うと例外 ThreadError が発生します。
...ead.new によるスレッドの追加は禁止されません。enclose されたスレッドグループ A に
属するスレッドが新たにスレッドを生成した場合、生成されたスレッドはスレッドグループ A に属します。
追加の例:
thg = ThreadGroup.new.en......close
thg.add Thread.new {}
=> -:2:in `add': can't move to the enclosed thread group (ThreadError)
削除の例:
thg1 = ThreadGroup.new
thg2 = ThreadGroup.new
th = Thread.new {sleep 1}
thg1.add th
thg1.enclose
thg2.add th
=> -:8:in `add': can't move from the enclosed thread g... -
File
:: Stat # <=>(o) -> Integer | nil (8031.0) -
ファイルの最終更新時刻を比較します。self が other よりも 新しければ正の数を、等しければ 0 を古ければ負の数を返します。 比較できない場合は nil を返します。
...fp1 = Tempfile.open("first")
fp1.print "古い方\n"
sleep(1)
fp2 = Tempfile.open("second")
fp2.print "新しい方\n"
p File::Stat.new(fp1.path) <=> File::Stat.new(fp2.path) #=> -1
p File::Stat.new(fp2.path) <=> File::Stat.new(fp1.path) #=> 1
p File::Stat.new(fp1.path) <=> fp2.path #=> nil
//}...