ライブラリ
- ビルトイン (6031)
クラス
- Array (87)
- BasicObject (143)
- Binding (11)
- Class (44)
- Data (34)
- Dir (77)
-
Encoding
:: Converter (220) -
Encoding
:: InvalidByteSequenceError (22) -
Encoding
:: UndefinedConversionError (11) - Enumerator (155)
-
Enumerator
:: Chain (6) -
Enumerator
:: Lazy (11) -
Enumerator
:: Yielder (27) -
Errno
:: EXXX (22) - Exception (44)
- Fiber (57)
- File (98)
-
File
:: Stat (440) - FrozenError (12)
- Hash (171)
- IO (708)
- KeyError (38)
- LocalJumpError (22)
- Method (182)
- Module (276)
- Mutex (14)
- NameError (26)
- NoMethodError (17)
- Numeric (11)
- Object (402)
-
ObjectSpace
:: WeakMap (11) - Proc (51)
- Random (110)
- Range (45)
- Regexp (88)
-
RubyVM
:: InstructionSequence (33) - SignalException (33)
- StopIteration (11)
- String (50)
- Struct (316)
- SystemCallError (44)
- SystemExit (22)
- Thread (450)
-
Thread
:: Backtrace :: Location (44) -
Thread
:: ConditionVariable (27) -
Thread
:: Mutex (63) -
Thread
:: Queue (102) -
Thread
:: SizedQueue (63) - ThreadGroup (44)
- Time (58)
- TracePoint (150)
- UnboundMethod (21)
モジュール
- Enumerable (132)
-
GC
:: Profiler (11) - Kernel (273)
- Marshal (44)
- ObjectSpace (77)
オブジェクト
- ENV (25)
キーワード
- ! (11)
- != (11)
-
$ stdin (11) - < (11)
- << (11)
- <=> (33)
- == (79)
- === (40)
- ArgumentError (11)
- BasicObject (11)
- Complex (22)
- ConditionVariable (9)
- Data (8)
- EXXX (11)
- Enumerator (11)
- Fiber (11)
- Float (11)
- Integer (11)
- Location (11)
-
MAJOR
_ VERSION (11) -
MINOR
_ VERSION (11) - Method (11)
- Proc (11)
- Queue (9)
- Range (11)
- Rational (22)
- Regexp (11)
- SizedQueue (9)
- Stat (11)
- String (11)
- Struct (11)
- Symbol (1)
- Thread (11)
- ThreadGroup (11)
- TracePoint (11)
- UnboundMethod (11)
- UndefinedConversionError (11)
- Yielder (11)
- [] (81)
- []= (33)
-
_ _ id _ _ (11) -
_ _ send _ _ (22) -
_ dump (11) - abort (22)
-
abort
_ on _ exception (11) -
abort
_ on _ exception= (22) -
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)
- compile (22)
-
compile
_ option= (11) - convert (11)
- convpath (11)
- ctime (11)
- current (3)
- deconstruct (2)
-
deconstruct
_ keys (2) - default (22)
-
default
_ proc (11) - define (4)
-
define
_ finalizer (22) -
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)
- dump (22)
- dup (3)
- each (132)
-
each
_ char (22) -
each
_ entry (22) -
each
_ line (66) -
each
_ object (44) -
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)
- exception (11)
- executable? (11)
-
executable
_ real? (11) - exit (11)
-
exit
_ value (11) - extend (11)
- extended (11)
- fail (33)
- feed (11)
- fetch (7)
- file? (11)
- filter (12)
- finish (11)
-
for
_ fd (11) - fork (11)
- ftype (11)
- getbyte (11)
- getc (11)
- gets (33)
- gid (11)
- grpowned? (11)
-
handle
_ interrupt (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)
-
keyword
_ init? (3) - kill (22)
-
kind
_ of? (11) - lambda (17)
- lambda? (11)
-
last
_ error (11) - length (20)
- lineno (22)
- lineno= (11)
- link (11)
- list (11)
-
local
_ variable _ set (11) - locked? (11)
- loop (18)
-
marshal
_ dump (22) -
marshal
_ load (11) - match (22)
- max (53)
- max= (9)
- members (24)
- 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)
-
new
_ seed (11) -
next
_ values (11) - nlink (11)
- now (11)
-
num
_ waiting (9) - open (88)
-
original
_ name (11) - owned? (22)
- owner (11)
- pack (16)
- parameters (17)
- pass (11)
- path (24)
-
peek
_ values (11) -
pending
_ interrupt? (11) - pipe (88)
- pipe? (11)
- pop (18)
- popen (154)
- prepend (11)
-
primitive
_ convert (44) -
primitive
_ errinfo (11) - priority (11)
- priority= (11)
- private (23)
- proc (18)
- produce (5)
- putback (22)
- raise (59)
-
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 (16) -
report
_ on _ exception= (16) -
respond
_ to? (11) -
respond
_ to _ missing? (11) - result (22)
- resume (11)
-
return
_ value (11) - rewind (11)
- run (11)
-
safe
_ level (7) -
search
_ convpath (11) - 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 (33)
- socket? (11)
-
source
_ encoding (11) -
source
_ location (11) - start (11)
- status (22)
- sticky? (11)
- stop (11)
- stop? (11)
- store (11)
- strftime (11)
- sum (16)
-
super
_ method (10) - symlink (11)
- 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) - trace (11)
-
trace
_ var (33) - transfer (3)
-
try
_ lock (11) - tty? (11)
- uid (11)
- unbind (11)
-
undef
_ method (11) -
undefine
_ finalizer (11) - ungetbyte (11)
- ungetc (11)
- unlock (11)
- utime (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 (22)
- zero? (11)
検索結果
先頭5件
-
Module
# prepend(*modules) -> self (8012.0) -
指定したモジュールを self の継承チェインの先頭に「追加する」ことで self の定数、メソッド、モジュール変数を「上書き」します。
...ule X
def foo
puts "X1" # (1x)
super # (2x)
puts "X2" # (3x)
end
end
class A
prepend X
def foo
puts "A" #(1a)
end
end
A.new.foo
# (1x) (2x)(ここの super で A#foo を呼びだす) (1a) (3x) の順に実行される
# >> X1
# >> A
# >> X2
# 2つのモジュールを X......ule Y
def foo
puts "Y1" #(1y)
super #(2y)
puts "Y2" #(3y)
end
end
class B
prepend X, Y
def foo
puts "B" # (1b)
end
end
B.new.foo
# (1x) (2x) (1y) (2y) (1b) (3y) (3x) の順に実行される
# X#foo のほうが Y#foo より継承チェインの手前側にあり、そち... -
Module
# refine(klass) { . . . } -> Module (8012.0) -
引数 klass で指定したクラスまたはモジュールだけに対して、ブロックで指定した機能を提供で きるモジュールを定義します。定義した機能は Module#refine を使用せずに直 接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。 そのため、既存の機能を局所的に修正したい場合などに用いる事ができます。
...機能を持つ無名のモジュールを返します。
//emlist[例][ruby]{
class C
def foo
puts "C#foo"
end
end
module M
refine C do
def foo
puts "C#foo in M"
end
end
end
x = C.new
x.foo # => "C#foo"
using M
x = C.new
x.foo # => "C#foo in M"
//}
@see main.using... -
Mutex
# owned? -> bool (8012.0) -
self がカレントスレッドによってロックされている場合に true を返します。 そうでない場合に false を返します。
...self がカレントスレッドによってロックされている場合に true を返します。
そうでない場合に false を返します。
//emlist[例][ruby]{
m = Mutex.new
m.owned? # => false
m.lock
Thread.new do
m.owned? # => false
end.join
m.owned? # => true
//}... -
Mutex
# sleep(timeout = nil) -> Integer (8012.0) -
与えられた秒数の間ロックを解除してスリープして、実行後にまたロックします。
...グナルを受信した場合などに実行が再
開(spurious wakeup)される場合がある点に注意してください。
//emlist[例][ruby]{
m = Mutex.new
th = Thread.new do
m.lock
m.sleep(2)
end
th.status # => "run"
sleep 1
th.status # => "sleep"
sleep 1
th.status # => false
//}... -
Object
# <=>(other) -> 0 | nil (8012.0) -
self === other である場合に 0 を返します。そうでない場合には nil を返します。
...self === other である場合に 0 を返します。そうでない場合には nil を返します。
//emlist[例][ruby]{
a = Object.new
b = Object.new
a <=> a # => 0
a <=> b # => nil
//}
@see Object#===... -
Object
# _ dump(limit) -> String (8012.0) -
Marshal.#dump において出力するオブジェクトがメソッド _dump を定義している場合には、そのメソッドの結果が書き出されます。
...alize(arg)
@foo = arg
end
def _dump(limit)
Marshal.dump(@foo, limit)
end
def self._load(obj)
p obj
Foo.new(Marshal.load(obj))
end
end
foo = Foo.new(['foo', 'bar'])
p foo #=> #<Foo:0xbaf234 @foo=["foo", "bar"]>
dms = Marshal.dump(foo)
p dms... -
Object
# extend(*modules) -> self (8012.0) -
引数で指定したモジュールのインスタンスメソッドを self の特異 メソッドとして追加します。
...def a
'ok Foo'
end
end
module Bar
def b
'ok Bar'
end
end
obj = Object.new
obj.extend Foo, Bar
p obj.a #=> "ok Foo"
p obj.b #=> "ok Bar"
class Klass
include Foo
extend Bar
end
p Klass.new.a #=> "ok Foo"
p Klass.b #=> "ok Bar"
//}
extend の機能は、「特異クラス... -
Object
# initialize _ copy(obj) -> object (8012.0) -
(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。
...ject.new
class <<obj
attr_accessor :foo
def bar
:bar
end
end
def check(obj)
puts "instance variables: #{obj.inspect}"
puts "tainted?: #{obj.tainted?}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end
end
obj.foo = 1
obj.taint
check Object.new.sen......list[][ruby]{
obj = Object.new
class <<obj
attr_accessor :foo
def bar
:bar
end
end
def check(obj)
puts "instance variables: #{obj.inspect}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end
end
obj.foo = 1
check Object.new.send(:initialize_copy, obj... -
Object
# to _ proc -> Proc (8012.0) -
オブジェクトの Proc への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...すが、
このメソッドは実際には Object クラスには定義されていません。
必要に応じてサブクラスで定義すべきものです。
//emlist[][ruby]{
def doing
yield
end
class Foo
def to_proc
Proc.new{p 'ok'}
end
end
it = Foo.new
doing(&it) #=> "ok"
//}... -
ObjectSpace
. # undefine _ finalizer(obj) -> object (8012.0) -
obj に対するファイナライザをすべて解除します。 obj を返します。
...ze"
}
end
def initialize
ObjectSpace.define_finalizer(self, Sample.callback)
end
def undef
ObjectSpace.undefine_finalizer(self)
end
end
Sample.new
GC.start
# => finalize
Sample.new
sample.undef
GC.start
# ※何も出力されない
//}
@see ObjectSpace.#define_finalizer... -
Random
# ==(other) -> bool (8012.0) -
乱数生成器が等しい状態であるならばtrue を返します。
...乱数生成器が等しい状態であるならばtrue を返します。
@param other 比較対象の乱数生成器
//emlist[例][ruby]{
r1 = Random.new(1)
r2 = Random.new(1)
p r1 == r2 # => true
r2.rand
p r1 == r2 # => false
r1.rand
p r1 == r2 # => true
//}... -
Random
# marshal _ dump -> Array (8012.0) -
Random#marshal_load で復元可能な配列を返します。
...Random#marshal_load で復元可能な配列を返します。
//emlist[例][ruby]{
r1 = Random.new(1)
a1 = r1.marshal_dump
r2 = Random.new(3)
p r1 == r2 # => false
r3 = r2.marshal_load(a1)
p r1 == r2 # => true
p r1 == r3 # => true
//}...