242件ヒット
[1-100件を表示]
(0.149秒)
ライブラリ
- ビルトイン (165)
- delegate (11)
- erb (11)
-
fiddle
/ import (11) -
rdoc
/ generator / darkfish (11) -
rdoc
/ generator / ri (11) -
rubygems
/ specification (11) - win32ole (11)
クラス
- BasicObject (44)
- ERB (11)
-
Gem
:: Specification (11) - Object (99)
-
RDoc
:: Generator :: Darkfish (11) -
RDoc
:: Generator :: RI (11) -
Thread
:: Backtrace :: Location (22) -
WIN32OLE
_ TYPE (11)
モジュール
-
Fiddle
:: Importer (11) - Kernel (11)
キーワード
- != (11)
- DelegateClass (11)
-
_ dump (11) -
absolute
_ path (11) - clone (11)
-
def
_ class (11) -
default
_ event _ sources (11) - dup (11)
-
initialize
_ copy (11) - inspect (22)
-
instance
_ eval (22) -
instance
_ variable _ defined? (11) -
instance
_ variable _ get (11) -
marshal
_ dump (11) -
method
_ missing (11) - struct (11)
-
yaml
_ initialize (11)
検索結果
先頭5件
-
RDoc
:: Generator :: Darkfish # initialize(store , options) -> RDoc :: Generator :: Darkfish (18202.0) -
RDoc::Generator::Darkfish オブジェクトを初期化します。
...RDoc::Generator::Darkfish オブジェクトを初期化します。
@param store RDoc::Store オブジェクトを指定します。
@param options RDoc::Options オブジェクトを指定します。... -
RDoc
:: Generator :: RI # initialize(store , options) -> RDoc :: Generator :: RI (18202.0) -
RDoc::Generator::RI オブジェクトを初期化します。
...RDoc::Generator::RI オブジェクトを初期化します。
@param store RDoc::Store オブジェクトを指定します。
@param options RDoc::Options オブジェクトを指定します。... -
Object
# initialize(*args , &block) -> object (18156.0) -
ユーザ定義クラスのオブジェクト初期化メソッド。
...
initialize には
Class#new に与えられた引数がそのまま渡されます。
サブクラスではこのメソッドを必要に応じて再定義されること
が期待されています。
initialize という名前のメソッドは自動的に private に設定され
ます。
@p......。
@param block 初期化時のブロック引数です。必須ではありません。
//emlist[][ruby]{
class Foo
def initialize name
puts "initialize Foo"
@name = name
end
end
class Bar < Foo
def initialize name, pass
puts "initialize Bar"
super name
@pass = pass
e......nd
end
it = Bar.new('myname','0500')
p it
#=> initialize Bar
# initialize Foo
# #<Bar:0x2b68f08 @name="myname", @pass="0500">
//}
@see Class#new... -
Object
# initialize _ copy(obj) -> object (12256.0) -
(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。
...ます。ただ
し、self のインスタンス変数や特異メソッドは変化しません。
Object#clone, Object#dupの内部で使われています。
initialize_copy は、Ruby インタプリタが知り得ない情報をコピーするた
めに使用(定義)されます。例えば C...... initialize_copy でコピーするよう定義しておくことで、dup や clone
を再定義する必要がなくなります。
デフォルトの Object#initialize_copy は、 freeze チェックおよび型のチェックを行い self
を返すだけのメソッドです。
initialize_cop......のメソッドは
自動的に private に設定されます。
@raise TypeError レシーバが freeze されているか、obj のクラスがレシーバ
のクラスと異なる場合に発生します。
@see Object#clone,Object#dup
以下に例として、dup や clone がこのメソッ... -
Gem
:: Specification # yaml _ initialize (9102.0) -
@todo
@todo -
Object
# _ dump(limit) -> String (6131.0) -
Marshal.#dump において出力するオブジェクトがメソッド _dump を定義している場合には、そのメソッドの結果が書き出されます。
...Marshal.#dump において出力するオブジェクトがメソッド _dump
を定義している場合には、そのメソッドの結果が書き出されます。
バージョン1.8.0以降ではObject#marshal_dump, Object#marshal_loadの使用
が推奨されます。 Marshal.dump するオ......mp と marshal_dump の両方の
メソッドを持つ場合は marshal_dump が優先されます。
メソッド _dump は引数として再帰を制限するレベル limit を受
け取り、オブジェクトを文字列化したものを返します。
インスタンスがメソッド _dump......あります。
@param limit 再帰の制限レベルを表す整数です。
@return オブジェクトを文字列化したものを返すように定義すべきです。
//emlist[][ruby]{
class Foo
def initialize(arg)
@foo = arg
end
def _dump(limit)
Marshal.dump(@foo, limit)
en... -
Object
# marshal _ dump -> object (6131.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......nd
end
foo = Foo.new(['foo', 'bar'])
p foo #=> #<Foo:0xbaf3b0 @foo=["foo", "bar"]>
dms = Marshal.dump(foo)
p dms #=> "\004\bU:\bFoo[\a\"\bfoo\"\bbar"
result = Marshal.load(dms) #=> ["foo", "bar"] # marshal_load の引数
p result #=> #<Foo:... -
Object
# inspect -> String (6119.0) -
オブジェクトを人間が読める形式に変換した文字列を返します。
...み込み関数 Kernel.#p は、このメソッドの結果を使用して
オブジェクトを表示します。
//emlist[][ruby]{
[ 1, 2, 3..4, 'five' ].inspect # => "[1, 2, 3..4, \"five\"]"
Time.new.inspect # => "2008-03-08 19:43:39 +0900"
//}
inspect メソッドをオーバ......変数の名前、値の組を元にした文字列を返します。
//emlist[][ruby]{
class Foo
end
Foo.new.inspect # => "#<Foo:0x0300c868>"
class Bar
def initialize
@bar = 1
end
end
Bar.new.inspect # => "#<Bar:0x0300c868 @bar=1>"
//}
@see Kernel.#p... -
Thread
:: Backtrace :: Location # inspect -> String (6113.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
...][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.inspect
end
# => "path/to/foo.rb:5:in `initialize'"
# "path/to/foo.rb:9:in `new'"
# "path/to/foo.rb:9:in `<main>'"
//}... -
Thread
:: Backtrace :: Location # absolute _ path -> String (6107.0) -
self が表すフレームの絶対パスを返します。
...][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see Thread::Backtrace::Location#path...