1648件ヒット
[1-100件を表示]
(0.048秒)
ライブラリ
クラス
-
ARGF
. class (192) - BasicObject (144)
- Class (48)
- ERB (12)
- Hash (36)
-
JSON
:: Parser (12) - Method (92)
- Module (270)
- NameError (10)
- Object (444)
- OptionParser (144)
- PP (12)
-
RDoc
:: CodeObject (12) -
WIN32OLE
_ TYPE (24) -
WIN32OLE
_ TYPELIB (24)
モジュール
キーワード
- ! (12)
- != (12)
- < (12)
- <=> (12)
- == (12)
- === (20)
- DelegateClass (12)
- [] (12)
-
_ _ send _ _ (24) -
_ dump (12) -
_ load (12) - allocate (12)
- ancestors (12)
- argv (12)
- call (24)
-
class
_ eval (24) -
class
_ exec (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) -
class
_ variables (12) - clone (12)
-
const
_ defined? (12) -
const
_ get (12) -
const
_ source _ location (12) - constants (12)
-
def
_ class (12) -
default
_ event _ sources (12) -
define
_ singleton _ method (24) - display (12)
- dup (12)
- each (48)
-
each
_ byte (24) -
each
_ char (24) -
each
_ line (48) - extend (12)
- getbyte (12)
- getc (12)
- include (12)
- initialize (12)
-
initialize
_ copy (12) - inspect (24)
-
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ method (12) -
instance
_ methods (12) -
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instance
_ variables (12) -
is
_ a? (12) -
kind
_ of? (12) -
marshal
_ dump (12) -
marshal
_ load (12) - max (48)
-
method
_ missing (12) - methods (12)
- min (48)
-
module
_ eval (24) -
module
_ exec (12) - new (12)
-
object
_ group (12) -
ole
_ classes (12) -
ole
_ type (12) -
ole
_ types (12) - on (144)
- parameters (12)
- parse (12)
-
pretty
_ print (12) -
pretty
_ print _ cycle (12) -
private
_ constant (9) -
public
_ constant (9) -
public
_ method (12) - putc (12)
- receiver (22)
-
remove
_ class _ variable (12) -
remove
_ classes _ and _ modules (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) - replace (12)
-
respond
_ to? (12) -
respond
_ to _ missing? (12) - send (24)
-
singleton
_ class (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) -
sort
_ by (24) - superclass (12)
- timeout (16)
-
to
_ ary (12) -
to
_ hash (12) -
to
_ int (12) -
to
_ json (12) -
to
_ json _ raw _ object (12) -
to
_ proc (12) -
to
_ regexp (12) -
to
_ s (24) -
to
_ str (12)
検索結果
先頭5件
-
Object
# class -> Class (27375.0) -
レシーバのクラスを返します。
...レシーバのクラスを返します。
//emlist[][ruby]{
p "ruby".class #=> String
p 100.class #=> Integer
p ARGV.class #=> Array
p self.class #=> Object
p Class.class #=> Class
p Kernel.class #=> Module
//}
@see Class#superclass,Object#kind_of?,Object#instance_of?... -
PP
# object _ group(obj) { . . . } -> () (18218.0) -
以下と等価な働きをするもので簡便のために用意されています。 group(1, '#<' + obj.class.name, '>') { ... }
...以下と等価な働きをするもので簡便のために用意されています。
group(1, '#<' + obj.class.name, '>') { ... }
@param obj 表示したいオブジェクトを指定します。
@see PrettyPrint#group... -
Object
# singleton _ class -> Class (15363.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
...lClass, TrueClass,
FalseClass を返します。
@raise TypeError レシーバが Integer、Float、Symbol の場合に発生します。
//emlist[][ruby]{
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
String.singleton_class #=> #<Class:String>
nil.singleton_class #=>......NilClass
//}
@see Object#class... -
Class
# superclass -> Class | nil (15332.0) -
自身のスーパークラスを返します。
...ile.superclass #=> IO
IO.superclass #=> Object
class Foo; end
class Bar < Foo; end
Bar.superclass #=> Foo
Object.superclass #=> BasicObject
//}
ただし BasicObject.superclass は nil を返します。
//emlist[例][ruby]{
BasicObject.superclass #=> nil
//}......@see Class#subclasses... -
Object
# initialize _ copy(obj) -> object (9316.0) -
(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。
...elf のインスタンス変数や特異メソッドは変化しません。
デフォルトでは、Object#clone の内部で Object#initialize_clone から、
また Object#dup の内部で Object#initialize_dup から呼ばれます。
initialize_copy は、Ruby インタプリタが知り得......alize_copy でコピーするよう定義しておくことで、dup や clone
を再定義する必要がなくなります。
デフォルトの Object#initialize_copy は、 freeze チェックおよび型のチェックを行い self
を返すだけのメソッドです。
initialize_copy と......ます。
@see Object#clone,Object#dup
以下に例として、dup や clone がこのメソッドをどのように利用しているかを示します。
obj.dup は、新たに生成したオブジェクトに対して
initialize_copy を呼び
//emlist[][ruby]{
obj2 = obj.class.allocate
obj2.... -
Class
# new(*args , &block) -> object (9266.0) -
自身のインスタンスを生成して返します。 このメソッドの引数はブロック引数も含め Object#initialize に渡されます。
...ブロック引数も含め Object#initialize に渡されます。
new は Class#allocate でインスタンスを生成し、
Object#initialize で初期化を行います。
@param args Object#initialize に渡される引数を指定します。
@param block Object#initialize に渡される......ブロックを指定します。
//emlist[例][ruby]{
# Class クラスのインスタンス、C クラスを生成
C = Class.new # => C
# Class クラスのインスタンス、C クラスのインスタンスを生成
C.new # => #<C:0x00005623f8b4e458>
//}... -
Object
# singleton _ methods(inherited _ too = true) -> [Symbol] (9245.0) -
そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。
...た特異メソッドとは Object#extend によって追加された特異メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタンスの特異メソッド)などです。
singleton_methods(false) は、Object#methods(false) と同じで......by]{
Parent = Class.new
class <<Parent
private; def private_class_parent() end
protected; def protected_class_parent() end
public; def public_class_parent() end
end
Foo = Class.new(Parent)
class <<Foo
private; def private_class_foo() end
protected; def protected_class_foo() end......public; def public_class_foo() end
end
module Bar
private; def private_bar() end
protected; def protected_bar() end
public; def public_bar() end
end
obj = Foo.new
class <<obj
include Bar
private; def private_self() end
protected; def protected_self() end
public;... -
Object
# initialize(*args , &block) -> object (9232.0) -
ユーザ定義クラスのオブジェクト初期化メソッド。
...。
このメソッドは Class#new から新しく生成されたオブ
ジェクトの初期化のために呼び出されます。他の言語のコンストラクタに相当します。
デフォルトの動作ではなにもしません。
initialize には
Class#new に与えられた引数......ません。
//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
end
end
it = Bar.new('myname','0500')
p it
#=> initialize Bar
# initialize......Foo
# #<Bar:0x2b68f08 @name="myname", @pass="0500">
//}
@see Class#new... -
Object
# send(name , *args) -> object (9227.0) -
オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。
...場合は
Object#public_send を使う方が良いでしょう。
@param name 文字列かSymbol で指定するメソッド名です。
@param args 呼び出すメソッドに渡す引数です。
//emlist[][ruby]{
p -365.send(:abs) #=> 365
p "ruby".send(:sub,/./,"R") #=> "Ruby"
class Foo
def......注意
methods = {1 => :foo,
2 => :bar,
3 => :baz}
# キーを使って関連するメソッドを呼び出す
# レシーバは任意(Foo クラスのインスタンスである必要もない)
p Foo.new.send(methods[1]) # => "foo"
p Foo.new.send(methods[2]) # => "bar"
p Foo.new.send......(methods[3]) # => "baz"
//}
@see Object#public_send, BasicObject#__send__, Object#method, Kernel.#eval, Proc, Method...