種類
ライブラリ
- ビルトイン (4528)
- bigdecimal (12)
- coverage (8)
- csv (60)
- date (12)
- delegate (108)
- digest (24)
- drb (12)
- e2mmap (6)
- erb (12)
- etc (12)
- fiber (8)
- fiddle (36)
-
fiddle
/ import (12) - fileutils (28)
- gdbm (36)
- ipaddr (24)
-
irb
/ context (12) -
irb
/ inspector (12) -
irb
/ magic-file (24) -
irb
/ output-method (36) -
irb
/ xmp (24) - json (204)
- matrix (36)
-
minitest
/ spec (7) -
minitest
/ unit (5) - mkmf (72)
-
net
/ ftp (24) -
net
/ http (72) -
net
/ imap (48) -
net
/ pop (156) -
net
/ smtp (88) - objspace (132)
- open-uri (32)
- openssl (384)
- optparse (192)
- ostruct (89)
- pathname (24)
- pp (136)
- prettyprint (36)
- prime (120)
- profiler (12)
- pstore (60)
- psych (242)
- pty (24)
- rake (24)
-
rdoc
/ code _ object (60) -
rdoc
/ markup (12) - resolv (24)
-
rexml
/ document (180) -
rexml
/ parsers / pullparser (24) -
rinda
/ rinda (36) -
rinda
/ tuplespace (12) -
ripper
/ filter (36) -
ripper
/ sexp (24) - rubygems (12)
-
rubygems
/ spec _ fetcher (24) -
rubygems
/ specification (24) - sdbm (36)
- set (27)
- shell (12)
-
shell
/ command-processor (6) -
shell
/ filter (6) -
shell
/ process-controller (6) - singleton (12)
- socket (348)
- stringio (48)
- strscan (24)
- tempfile (60)
-
test
/ unit (1) - thread (12)
- timeout (29)
- tmpdir (24)
- uri (24)
-
webrick
/ httpauth / authenticator (12) -
webrick
/ httpauth / basicauth (12) - win32ole (732)
- zlib (108)
クラス
-
ARGF
. class (36) - Addrinfo (72)
- Array (453)
- BasicObject (48)
- BigDecimal (12)
- Binding (12)
- CSV (48)
- Class (36)
- Complex (12)
- Coverage (8)
- Data (9)
- Date (12)
- Delegator (48)
-
Digest
:: Base (12) - Dir (144)
- ERB (12)
- Enumerator (120)
-
Enumerator
:: Lazy (48) -
Enumerator
:: Yielder (24) - Fiber (54)
-
Fiddle
:: Pointer (12) - File (36)
- FrozenError (6)
- GDBM (36)
-
Gem
:: SpecFetcher (24) -
Gem
:: Specification (24) - Hash (283)
- IO (348)
- IPAddr (24)
-
IRB
:: Context (12) -
IRB
:: Inspector (12) -
IRB
:: OutputMethod (36) - Integer (24)
-
JSON
:: Parser (24) -
JSON
:: State (12) - KeyError (16)
- LocalJumpError (12)
- Matrix (24)
- Method (36)
- Module (410)
- NameError (34)
-
Net
:: FTP (24) -
Net
:: HTTP (48) -
Net
:: HTTPGenericRequest (24) -
Net
:: IMAP (12) -
Net
:: IMAP :: FetchData (12) -
Net
:: IMAP :: ResponseCode (12) -
Net
:: IMAP :: UntaggedResponse (12) -
Net
:: POP3 (48) -
Net
:: POPMail (108) -
Net
:: SMTP (88) - NoMethodError (12)
- Numeric (12)
- Object (886)
-
ObjectSpace
:: WeakMap (24) -
OpenSSL
:: ASN1 :: ASN1Data (12) -
OpenSSL
:: ASN1 :: ObjectId (96) -
OpenSSL
:: SSL :: SSLContext (12) -
OpenSSL
:: X509 :: Attribute (48) -
OpenSSL
:: X509 :: Name (108) -
OpenSSL
:: X509 :: Store (12) -
OpenSSL
:: X509 :: StoreContext (12) - OpenStruct (89)
- OptionParser (144)
-
OptionParser
:: ParseError (12) - PP (72)
- PStore (48)
-
PStore
:: DummyMutex (12) - Pathname (24)
- PrettyPrint (36)
- Prime (48)
-
Prime
:: PseudoPrimeGenerator (48) - Proc (31)
-
Psych
:: Nodes :: Node (24) -
Psych
:: ScalarScanner (12) -
Psych
:: Visitors :: YAMLTree (24) -
RDoc
:: CodeObject (60) -
RDoc
:: Markup (12) -
RDoc
:: Options (12) -
REXML
:: Attribute (12) -
REXML
:: DocType (12) -
REXML
:: Elements (24) -
REXML
:: Parent (132) -
REXML
:: Parsers :: PullEvent (24) -
Rake
:: TaskArguments (12) - Range (36)
- Regexp (36)
-
Resolv
:: DNS (24) -
Rinda
:: DRbObjectTemplate (24) -
Rinda
:: TupleEntry (12) - Ripper (24)
-
Ripper
:: Filter (36) - SDBM (36)
- Set (36)
- Shell (12)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) -
Shell
:: ProcessController (6) - SimpleDelegator (36)
- Socket (168)
- StopIteration (12)
- String (81)
- StringIO (48)
- StringScanner (24)
- Struct (24)
- Symbol (4)
- Tempfile (60)
- Thread (48)
-
Thread
:: Queue (36) -
Thread
:: SizedQueue (36) - TracePoint (90)
- UNIXServer (48)
- UNIXSocket (60)
- UnboundMethod (12)
- UncaughtThrowError (22)
- Vector (12)
-
WEBrick
:: HTTPAuth :: BasicAuth (12) - WIN32OLE (48)
-
WIN32OLE
_ METHOD (120) -
WIN32OLE
_ PARAM (84) -
WIN32OLE
_ TYPE (264) -
WIN32OLE
_ TYPELIB (144) -
WIN32OLE
_ VARIABLE (12) -
WIN32OLE
_ VARIANT (24) - XMP (12)
-
Zlib
:: GzipReader (48) -
Zlib
:: GzipWriter (60)
モジュール
- Comparable (15)
- Enumerable (368)
- Etc (12)
- Exception2MessageMapper (6)
- Fiddle (24)
- FileUtils (28)
-
GC
:: Profiler (24) - Gem (12)
- JSON (144)
- Kernel (526)
- Marshal (72)
-
MiniTest
:: Assertions (5) - ObjectSpace (252)
-
OpenSSL
:: ASN1 (48) -
OpenSSL
:: X509 (12) -
OptionParser
:: Arguable (24) - PTY (24)
-
Process
:: GID (24) -
Process
:: UID (24) -
Profiler
_ _ (6) - Psych (114)
-
Rake
:: Cloneable (12) -
Test
:: Unit (1) - Timeout (21)
- URI (40)
-
WEBrick
:: HTTPAuth :: Authenticator (12)
オブジェクト
- ENV (4)
-
IRB
:: MagicFile (24)
キーワード
- != (12)
- !~ (12)
-
$ > (12) -
$ stdin (12) -
$ stdout (12) - % (12)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - < (12)
- << (36)
- <=> (24)
- == (39)
- === (48)
- =~ (9)
- ARGF (12)
- ARGV (24)
- Arguable (12)
- Array (12)
-
BUILD
_ RUBY _ PLATFORM (12) - CSV (12)
- DATA (12)
-
DEFAULT
_ OBJECT _ TYPE (12) -
DEFAULT
_ PARAMS (12) - DRbObjectTemplate (12)
- DRbProtocol (12)
- Data (3)
- DelegateClass (12)
- Digest (12)
- ENV (12)
- Enumerator (12)
- Float (12)
- Importer (12)
- Integer (12)
- JSON (12)
-
MAJOR
_ VERSION (12) -
MINOR
_ VERSION (12) - Marshal フォーマット (12)
- Method (12)
-
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - OBJECT (12)
-
OBJECT
_ DESCRIPTOR (12) -
OBJECT
_ TYPE _ TEMPLATE (12) - ObjectId (36)
- ObjectSpace (12)
- Options (12)
-
Profiler
_ _ (6) -
RUBY
_ COPYRIGHT (12) -
RUBY
_ DESCRIPTION (12) -
RUBY
_ ENGINE (12) -
RUBY
_ PATCHLEVEL (12) -
RUBY
_ PLATFORM (12) - Rational (7)
- Ruby プログラムの実行 (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Rubyの起動 (12)
-
SCRIPT
_ LINES _ _ (12) -
SC
_ TYPED _ MEMORY _ OBJECTS (12) - SSLContext (12)
- Set (3)
- SimpleDelegator (12)
- Singleton (12)
- String (12)
-
TOPLEVEL
_ BINDING (12) -
TRUST
_ OBJECT _ SIGN (12) - Thread (12)
-
WIN32OLE
_ PARAM (12) -
WIN32OLE
_ TYPE (12) -
WIN32OLE
_ TYPELIB (12) - WeakMap (12)
- [] (120)
- []= (36)
-
_ _ getobj _ _ (12) -
_ _ setobj _ _ (12) -
_ dump (12) -
_ getproperty (12) -
_ id2ref (12) -
_ invoke (12) - add (12)
-
add
_ entry (12) - all (36)
-
allocation
_ sourcefile (12) -
allocation
_ sourceline (12) - ancestors (12)
- args (12)
-
array
_ attributes (12) -
assert
_ empty (1) -
assert
_ equal (1) -
assert
_ respond _ to (1) -
assert
_ same (1) - attr (12)
- begin (12)
- bind (24)
- binding (12)
-
body
_ stream (12) -
body
_ stream= (12) -
boot
_ defclass (12) - catch (24)
- cd (14)
- chdir (62)
- clamp (27)
- class (12)
-
class
_ eval (24) -
class
_ exec (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) - clone (36)
-
cofactor
_ expansion (12) - collect (60)
-
compare
_ by _ identity (12) - component (12)
-
connect
_ from (24) -
connect
_ to (24) -
const
_ defined? (12) -
const
_ get (12) -
const
_ source _ location (12) - constants (24)
- context (12)
- convert (12)
-
convertible
_ int (24) -
count
_ nodes (12) -
count
_ objects (12) -
count
_ objects _ size (12) -
count
_ tdata _ objects (12) - coverage (8)
- create (24)
- data (24)
- debug (12)
-
def
_ class (12) -
def
_ inspector (12) - default (36)
-
default
_ event _ sources (12) -
default
_ ole _ types (12) -
default
_ value (12) -
define
_ finalizer (24) - delete (72)
-
delete
_ at (12) -
delete
_ field (12) -
delete
_ if (24) -
deprecate
_ constant (12) - deq (24)
- detect (24)
- dig (10)
- disable (24)
- dispid (12)
- display (12)
- dlunwrap (12)
-
drb
/ extservm (12) - dump (60)
-
dump
_ stream (12) - dup (52)
- each (144)
-
each
_ active _ object (6) -
each
_ char (24) -
each
_ child (24) -
each
_ object (48) -
each
_ prime (24) - enable (24)
-
enum
_ for (48) - eql? (51)
- equal? (12)
- eval (36)
-
exit
_ value (12) - extend (12)
-
extend
_ object (6) - extended (12)
-
fast
_ unparse (12) - feed (12)
- fetch (120)
-
fetch
_ spec (12) - file (12)
- fill (72)
-
filter
_ map (12) - find (24)
- first (48)
-
for
_ fd (12) - format (24)
- freeze (12)
- frozen? (12)
-
garbage
_ collect (12) - generate (12)
- gets (12)
-
global
_ variables (12) - grep (24)
-
grep
_ v (24) - guid (24)
-
handle
_ interrupt (12) - hash (27)
- helpcontext (24)
- helpfile (24)
-
implemented
_ ole _ types (12) - include (12)
- index (7)
- initialize (12)
-
initialize
_ copy (12) -
initialize
_ dup (12) - inject (48)
- input? (12)
- inspect (78)
-
inspect
_ mode (12) - instance (24)
-
instance
_ eval (24) -
instance
_ methods (12) -
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instance
_ variable _ set (12) -
instance
_ variables (12) - irb (12)
-
irb
/ completion (12) -
is
_ a? (12) - j (12)
- join (12)
- key (20)
- keys (12)
-
kind
_ of? (12) - lambda (13)
-
laplace
_ expansion (12) - last (24)
-
library
_ name (12) - ln (12)
- load (39)
-
load
_ documents (8) -
load
_ file (24) -
load
_ file! (12) -
load
_ specs (12) -
load
_ stream (24) -
local
_ variables (12) - logger (24)
-
long
_ name (12) - lookup (12)
- loop (24)
- mail (36)
- main (12)
-
major
_ version (24) - map (48)
-
marshal
_ dump (24) - match (48)
-
max
_ by (48) -
memsize
_ of (12) -
memsize
_ of _ all (12) - method (12)
-
method
_ missing (12) - methods (12)
-
minitest
/ spec (1) -
minor
_ version (24) - mktmpdir (24)
- modifiable (12)
-
module
_ eval (24) -
module
_ exec (12) -
mu
_ pp (1) -
must
_ be _ close _ to (1) -
must
_ be _ empty (1) -
must
_ be _ within _ delta (1) -
must
_ be _ within _ epsilon (1) -
must
_ equal (1) -
must
_ match (1) -
must
_ respond _ to (1) - name (48)
-
net
/ smtp (12) - new (391)
-
next
_ values (12) - nil? (12)
-
object
_ group (12) -
object
_ id (12) - oid (24)
- oid= (12)
-
ole
_ classes (24) -
ole
_ methods (12) -
ole
_ type (36) -
ole
_ type _ detail (12) -
ole
_ typelib (24) -
ole
_ types (12) - on (144)
-
on
_ XXX (12) -
on
_ default (12) - open (464)
- optional? (12)
- output (12)
- parameters (43)
- params (12)
- parent (12)
- parent= (12)
-
parent
_ file _ name (12) -
parent
_ name (12) - parse (60)
- parse! (12)
-
parse
_ openssl (12) -
parse
_ rfc2253 (12) - partition (24)
- path (12)
- peek (12)
-
peek
_ values (12) -
pending
_ interrupt? (12) - pipe (96)
- pop (84)
- popen (168)
- pp (48)
- ppx (12)
-
pretty
_ generate (12) -
pretty
_ inspect (12) -
pretty
_ print (12) -
pretty
_ print _ cycle (12) -
pretty
_ print _ inspect (12) -
pretty
_ print _ instance _ variables (12) -
pretty
_ unparse (12) -
private
_ constant (9) -
private
_ instance _ methods (12) -
private
_ methods (12) - proc (14)
- progid (12)
-
protected
_ instance _ methods (12) -
protected
_ methods (24) -
psych
_ to _ yaml (12) -
psych
_ y (12) -
psych
_ yaml _ as (4) - public (48)
-
public
_ constant (9) -
public
_ instance _ method (12) -
public
_ instance _ methods (12) -
public
_ method (12) -
public
_ methods (24) -
public
_ send (24) - push (24)
- pushd (6)
- pushdir (6)
- putc (60)
- puts (12)
- raise (18)
-
rb
_ data _ object _ alloc (12) -
rb
_ define _ class _ under (12) -
rb
_ obj _ dup (12) -
rb
_ obj _ frozen _ p (12) -
rb
_ obj _ inspect (12) -
rb
_ obj _ private _ methods (12) -
rb
_ obj _ protected _ methods (12) -
rcptto
_ list (12) - rdoc (12)
-
reachable
_ objects _ from (12) -
read
_ nonblock (12) - readline (12)
- receiver (24)
-
recv
_ io (12) - reduce (36)
- register (12)
- rehash (12)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) - replace (12)
- report (12)
-
require
_ relative (12) -
respond
_ to? (24) -
respond
_ to _ missing? (12) - responses (12)
- restore (24)
- result (24)
- resume (12)
-
return
_ type (12) -
return
_ type _ detail (12) -
return
_ value (12) -
return
_ vtype (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
safe
_ load (19) - sample (48)
-
save
_ exception _ mode (12) -
scan
_ full (12) -
search
_ full (12) - self (12)
- send (24)
- set (9)
-
setup
_ argv (1) - sexp (12)
-
sexp
_ raw (12) -
sharing
_ detection (12) -
sharing
_ detection= (12) - shift (60)
-
short
_ name (12) -
singleline
_ format (12) -
singleline
_ pp (12) -
singleton
_ methods (12) -
size
_ opt _ params (12) -
size
_ params (12) - slice (36)
- sn (12)
-
sort
_ by (24) -
source
_ ole _ types (12) - sprintf (12)
- sprintf フォーマット (12)
-
src
_ type (12) - start (168)
-
start
_ profile (6) - stat (11)
-
stop
_ doc (12) - store (12)
- sum (21)
- superclass (12)
- switch (48)
- synchronize (12)
- tag (11)
- taint (6)
- tainted? (6)
- tally (8)
- tap (12)
- tcp (24)
-
tcp
_ server _ sockets (48) - timeout (29)
-
to
_ a (12) -
to
_ ary (12) -
to
_ enum (48) -
to
_ h (19) -
to
_ hash (24) -
to
_ int (12) -
to
_ proc (16) -
to
_ regexp (12) -
to
_ ruby (12) -
to
_ s (72) -
to
_ str (12) -
to
_ value (12) -
to
_ yaml (12) - tokenize (12)
-
trace
_ object _ allocations (12) -
trace
_ object _ allocations _ start (12) -
trace
_ object _ allocations _ stop (12) - transact (6)
- transaction (12)
- transfer (12)
- transform (12)
- trust= (24)
- typekind (12)
-
udp
_ server _ sockets (48) -
undefine
_ finalizer (12) - uniq (24)
- uniq! (24)
- unix (24)
-
unix
_ server _ socket (24) - unpack1 (9)
- unparse (12)
- unshift (12)
- untaint (6)
-
used
_ modules (12) - value (35)
- values (12)
-
values
_ at (24) - variables (12)
- version (12)
- visible? (24)
-
win
_ platform? (12) -
with
_ index (24) -
with
_ object (24) -
with
_ werror (24) - wrap (48)
- write (12)
-
write
_ nonblock (12) - xmp (12)
- xpopen (24)
- y (12)
- yaml (12)
-
yaml
_ as (4) -
yaml
_ tag (12) - yield (24)
- zip (48)
- このマニュアルのヘルプ (12)
- オブジェクト (12)
- クラス/メソッドの定義 (12)
- スレッド (12)
- セキュリティモデル (12)
- メソッド呼び出し(super・ブロック付き・yield) (12)
- 変数と定数 (12)
検索結果
先頭5件
-
Object
# pretty _ print _ inspect -> String (33244.0) -
Object#pretty_print を使って Object#inspect と同様に オブジェクトを人間が読める形式に変換した文字列を返します。
...
Object#pretty_print を使って Object#inspect と同様に
オブジェクトを人間が読める形式に変換した文字列を返します。
出力する全てのオブジェクトに Object#pretty_print が定義されている必要があります。
そうでない場合には RuntimeEr......ror が発生します。
@raise RuntimeError 出力する全てのオブジェクトに Object#pretty_print が定義されて
いない場合に発生します。... -
Object
# pretty _ print _ cycle(pp) -> () (33222.0) -
プリティプリント時にオブジェクトの循環参照が検出された場合、 Object#pretty_print の代わりに呼ばれるメソッドです。
...、
Object#pretty_print の代わりに呼ばれるメソッドです。
あるクラスの pp の出力をカスタマイズしたい場合は、
このメソッドも再定義する必要があります。
@param pp PP オブジェクトです。
//emlist[][ruby]{
class Array
def pretty_print......_cycle(q)
q.text(empty? ? '[]' : '[...]')
end
end
//}
@see Object#pretty_print... -
Object
# pretty _ print(pp) -> () (33212.0) -
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
...
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに
呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
あるクラスの pp の出力をカスタマイズしたい場合は、このメソッドを再定義します。
そのと...... pretty_print メソッドは指定された pp に対して表示したい自身の内容を追加して
いかなければいけません。いくつかの組み込みクラスについて、
pp ライブラリはあらかじめ pretty_print メソッドを定義しています。
@param pp PP......ブジェクトです。
//emlist[][ruby]{
require 'pp'
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}
@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable......オブジェクトです。
//emlist[][ruby]{
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}
@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable... -
Object
# pretty _ print _ instance _ variables -> [String | Symbol] (33200.0) -
プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。 返されたインスタンス変数はプリティプリント時に表示されます。
...表示すべき自身のインスタンス変数名の配列をソートして返します。
返されたインスタンス変数はプリティプリント時に表示されます。
pp に表示したくないインスタンス変数がある場合にこのメソッドを再定義します。... -
Object
# initialize _ copy(obj) -> object (27297.0) -
(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。
...数や特異メソッドは変化しません。
デフォルトでは、Object#clone の内部で Object#initialize_clone から、
また Object#dup の内部で Object#initialize_dup から呼ばれます。
initialize_copy は、Ruby インタプリタが知り得ない情報をコピーする......lize_copy でコピーするよう定義しておくことで、dup や clone
を再定義する必要がなくなります。
デフォルトの Object#initialize_copy は、 freeze チェックおよび型のチェックを行い self
を返すだけのメソッドです。
initialize_copy と......のメソッドは
自動的に private に設定されます。
@raise TypeError レシーバが freeze されているか、obj のクラスがレシーバ
のクラスと異なる場合に発生します。
@see Object#clone,Object#dup
以下に例として、dup や clone がこのメソッ... -
Object
# object _ id -> Integer (27239.0) -
各オブジェクトに対して一意な整数を返します。あるオブジェクトに対し てどのような整数が割り当てられるかは不定です。
...られるかは不定です。
Rubyでは、(Garbage Collectされていない)アクティブなオブジェクト間で
重複しない整数(object_id)が各オブジェクトにひとつずつ割り当てられています。この
メソッドはその値を返します。
TrueClass, FalseCla......じ object_id になります。
これは、Immutable ならば複数の場所から参照されても`破壊的操作'による問題が発生しないので、
同じ内容のインスタンスを複数生成しないという内部実装が理由です。
//emlist[][ruby]{
p "ruby".object_id #......=> 60
p "ruby".object_id #=> 80
p [].object_id #=> 100
p [].object_id #=> 120
p :ruby.object_id #=> 710428
p :ruby.object_id #=> 710428
p 11.object_id #=> 23
p 11.object_id #=> 23
p true.object_id #=> 20
p true.object_id #=> 20
//}
@see Object#equal?,Symbol... -
Object
# initialize _ dup(obj) -> object (27235.0) -
Object#dup がオブジェクトを複製する際に呼び出すメソッドです。
...
Object#dup がオブジェクトを複製する際に呼び出すメソッドです。
デフォルトでは Object#initialize_copy を呼び出します。
initialize_dup という名前のメソッドは自動的に private に設定されます。
@see Object#initialize_copy, Object#initializ... -
Object
# marshal _ dump -> object (27231.0) -
Marshal.#dump を制御するメソッドです。
...Marshal.#dump を制御するメソッドです。
Marshal.dump(some) において、出力するオブジェクト some がメソッド marshal_dump を
持つ場合には、その返り値がダンプされたものが Marshal.dump(some) の返り値となります。
marshal_dump/marshal_load......dump/_load ではなく
marshal_dump/marshal_load を使うべきです。
@return 任意のオブジェクトで marshal_load の引数に利用できます。
//emlist[][ruby]{
class Foo
def initialize(arg)
@foo = arg
end
def marshal_dump
@foo
end
def marshal_load(obj)
p ob......定義されていてもマーシャルできるようになります
(特異メソッドの情報が自動的に dump されるようになるわけではなく、
marshal_dump/marshal_load によりそれを実現する余地があるということです)。
@see Object#marshal_load, Marshal... -
Object
# to _ proc -> Proc (27212.0) -
オブジェクトの Proc への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...オブジェクトの 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"
//}...