1341件ヒット
[1-100件を表示]
(0.088秒)
種類
ライブラリ
- ビルトイン (945)
- erb (11)
-
fiddle
/ import (22) - forwardable (22)
-
mutex
_ m (11) - objspace (11)
- rake (11)
-
rdoc
/ class _ module (11) -
rdoc
/ code _ object (11) -
rdoc
/ context (44) -
rdoc
/ top _ level (33) - win32ole (22)
クラス
- BasicObject (55)
- Class (22)
- ERB (11)
-
Enumerator
:: Lazy (11) - Method (11)
- Module (626)
- Object (132)
- Proc (11)
-
RDoc
:: CodeObject (11) -
RDoc
:: Context (44) -
RDoc
:: TopLevel (33) - TracePoint (11)
- UnboundMethod (11)
-
WIN32OLE
_ TYPE (22)
モジュール
-
Fiddle
:: Importer (22) - Kernel (33)
- Marshal (22)
-
Mutex
_ m (11) - ObjectSpace (11)
キーワード
- < (11)
- <=> (11)
- === (11)
- ClassModule (11)
- Forwardable (11)
- Marshal フォーマット (11)
- RMODULE (11)
- Ruby プログラムの実行 (11)
- Ruby用語集 (11)
- SingleForwardable (11)
-
add
_ class _ or _ module (22) -
add
_ module (11) -
all
_ classes _ and _ modules (11) - ancestors (11)
-
append
_ features (22) - attr (9)
-
attr
_ accessor (3) -
attr
_ reader (3) -
attr
_ writer (3) - autoload (22)
-
boot
_ defclass (11) - class (11)
-
class
_ eval (22) -
class
_ exec (11) -
class
_ variable _ defined? (11) -
class
_ variable _ get (11) -
class
_ variable _ set (11) -
class
_ variables (11) -
const
_ defined? (11) -
const
_ get (11) -
const
_ missing (11) -
const
_ source _ location (5) - constants (22)
-
count
_ objects _ size (11) - debug (11)
-
def
_ module (11) -
default
_ event _ sources (11) -
define
_ method (22) -
defined
_ class (11) - dump (22)
-
each
_ classmodule (11) - extend (11)
-
find
_ local _ symbol (11) -
global
_ variables (11) - include (11)
- include? (11)
-
include
_ class _ new (11) - included (11)
-
initialize
_ classes _ and _ modules (11) - inspect (11)
-
instance
_ eval (22) -
instance
_ method (11) -
instance
_ methods (11) -
instance
_ variables (11) -
is
_ a? (11) -
kind
_ of? (11) - lambda? (11)
-
local
_ variables (11) -
method
_ added (11) -
method
_ defined? (11) -
method
_ removed (11) -
method
_ undefined (11) - methods (11)
-
module
_ eval (22) -
module
_ exec (11) - name (11)
- nesting (11)
- new (33)
-
ole
_ type (11) - owner (22)
- prepend (11)
-
prepend
_ features (11) - prepended (11)
- private (23)
-
private
_ class _ method (15) -
private
_ constant (11) -
private
_ method _ defined? (11) -
protected
_ method _ defined? (11) -
public
_ class _ method (15) -
public
_ constant (11) -
public
_ method (11) -
public
_ method _ defined? (11) -
rake
_ extension (11) -
rb
_ class _ instance _ methods (11) -
rb
_ class _ path (11) -
rb
_ class _ private _ instance _ methods (11) -
rb
_ class _ protected _ instance _ methods (11) -
rdoc
/ class _ module (11) - refine (11)
-
remove
_ class _ variable (11) -
remove
_ classes _ and _ modules (11) -
remove
_ const (11) -
remove
_ instance _ variable (11) -
remove
_ method (11) -
respond
_ to? (11) -
ruby 1
. 8 . 2 feature (11) -
singleton
_ class? (11) -
singleton
_ method (11) -
singleton
_ method _ added (11) -
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) - struct (11)
-
to
_ s (11) -
undef
_ method (11) - union (11)
- yaml (11)
- 制御構造 (11)
- 変数と定数 (11)
- 字句構造 (11)
検索結果
先頭5件
-
Class (44060.0)
-
クラスのクラスです。
...正確に言えば、個々のクラスはそれぞれメタクラスと呼
ばれる名前のないクラスをクラスとして持っていて、Class はそのメタ
クラスのクラスです。この関係は少し複雑ですが、Ruby を利用するにあたっ
ては特に重要ではあ......すが、それ以外のほとんどの機能は Module から継
承されています。Module のメソッドのうち
* Module#module_function
* Module#extend_object
* Module#append_features
* Module#prepend_features
* Module#refine
は Class では未定義にされています。... -
Module
# class _ variables(inherit = true) -> [Symbol] (36243.0) -
クラス/モジュールに定義されているクラス変数の名前の配列を返します。
...rit false を指定しない場合はスーパークラスやインクルードして
いるモジュールのクラス変数を含みます。
//emlist[例][ruby]{
class One
@@var1 = 1
end
class Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_variables......# => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}
@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#constants... -
Module
# class _ variable _ defined?(name) -> bool (36231.0) -
name で与えられた名前のクラス変数がモジュールに存在する場合 true を 返します。
...name Symbol か String を指定します。
//emlist[例][ruby]{
class Fred
@@foo = 99
end
Fred.class_variable_defined?(:@@foo) #=> true
Fred.class_variable_defined?(:@@bar) #=> false
Fred.class_variable_defined?('@@foo') #=> true
Fred.class_variable_defined?('@@bar') #=> false
//}... -
Module
# remove _ class _ variable(name) -> object (36225.0) -
引数で指定したクラス変数を取り除き、そのクラス変数に設定さ れていた値を返します。
...ymbol を指定します。
@return 引数で指定されたクラス変数に設定されていた値を返します。
@raise NameError 引数で指定されたクラス変数がそのモジュールやクラスに定義されていない場合に発生します。
//emlist[例][ruby]{
class Fo......o
@@foo = 1
remove_class_variable(:@@foo) # => 1
p @@foo # => uninitialized class variable @@foo in Foo (NameError)
end
//}
@see Module#remove_const, Object#remove_instance_variable... -
Module
# singleton _ class? -> bool (36225.0) -
self が特異クラスの場合に true を返します。そうでなければ false を返し ます。
...self が特異クラスの場合に true を返します。そうでなければ false を返し
ます。
//emlist[例][ruby]{
class C
end
C.singleton_class? # => false
C.singleton_class.singleton_class? # => true
//}... -
Module
# class _ variable _ get(name) -> object (36213.0) -
クラス/モジュールに定義されているクラス変数 name の値を返します。
...の値を返します。
@param name String または Symbol を指定します。
@raise NameError クラス変数 name が定義されていない場合、発生します。
//emlist[例][ruby]{
class Fred
@@foo = 99
end
def Fred.foo
class_variable_get(:@@foo)
end
p Fred.foo #=> 99
//}... -
Module
# class _ variable _ set(name , val) -> object (36213.0) -
クラス/モジュールにクラス変数 name を定義して、その値として val をセットします。val を返します。
...義して、その値として
val をセットします。val を返します。
@param name String または Symbol を指定します。
//emlist[例][ruby]{
class Fred
@@foo = 99
def foo
@@foo
end
end
def Fred.foo(val)
class_variable_set(:@@foo, val)
end
p Fred.foo(101) # => 10... -
Module
# class _ exec(*args) {|*vars| . . . } -> object (33238.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...ュールのコンテキストで評価します。
モジュールのコンテキストで評価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ローカル変......定します。
//emlist[例][ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
end
define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end
}
t = Thing.new
p t.hello() #=> "Hello there!"
p t.foo()......#=> 1
//}
@see Module#module_eval, Module#class_eval... -
Module
# module _ exec(*args) {|*vars| . . . } -> object (33238.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...ュールのコンテキストで評価します。
モジュールのコンテキストで評価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ローカル変......定します。
//emlist[例][ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
end
define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end
}
t = Thing.new
p t.hello() #=> "Hello there!"
p t.foo()......#=> 1
//}
@see Module#module_eval, Module#class_eval... -
Module
# class _ eval {|mod| . . . } -> object (33234.0) -
モジュールのコンテキストで文字列 expr またはモジュール自身をブロックパラメータとするブロックを 評価してその結果を返します。
...価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ただし、ローカル変数は module_eval/class_eval の外側のスコープと共有します。
文字......@param lineno 文字列を指定します。行番号 lineno から文字列 expr が書かれているかのように実行されます。
スタックトレースの表示などを差し替えることができます。
//emlist[例][ruby]{
class C
end
a = 1
C.class_eval %Q{
def......m # メソッドを動的に定義できる。
return :m, #{a}
end
}
p C.new.m #=> [:m, 1]
//}
@see BasicObject#instance_eval, Module.new, Kernel.#eval...