種類
ライブラリ
- ビルトイン (1000)
- erb (11)
-
fiddle
/ import (22) - forwardable (22)
- monitor (11)
-
mutex
_ m (22) - objspace (11)
- rake (11)
-
rdoc
/ class _ module (11) -
rdoc
/ code _ object (11) -
rdoc
/ context (44) -
rdoc
/ top _ level (33) - win32ole (22)
クラス
- BasicObject (66)
- Class (22)
- ERB (11)
-
Enumerator
:: Lazy (11) - Method (33)
- Module (626)
- Object (132)
- Proc (11)
-
RDoc
:: CodeObject (11) -
RDoc
:: Context (44) -
RDoc
:: TopLevel (33) - TracePoint (11)
- UnboundMethod (22)
-
WIN32OLE
_ TYPE (22)
モジュール
-
Fiddle
:: Importer (22) - Kernel (33)
- Marshal (22)
-
Mutex
_ m (11) - ObjectSpace (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - < (11)
- <=> (11)
- === (11)
- Class (11)
- ClassModule (11)
- Forwardable (11)
- Marshal フォーマット (11)
- MonitorMixin (11)
-
Mutex
_ m (11) -
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - RMODULE (11)
- Ruby プログラムの実行 (11)
- Ruby用語集 (11)
- SingleForwardable (11)
- UnboundMethod (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)
- bind (11)
-
boot
_ defclass (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) - drb (11)
- dump (22)
- e2mmap (6)
-
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 (22)
-
instance
_ eval (22) -
instance
_ exec (11) -
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 (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
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 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 (22) -
undef
_ method (11) - union (11)
- yaml (11)
- クラス/メソッドの定義 (11)
- 制御構造 (11)
- 変数と定数 (11)
- 字句構造 (11)
- 演算子式 (11)
検索結果
先頭5件
-
Module
# class _ variables(inherit = true) -> [Symbol] (27143.0) -
クラス/モジュールに定義されているクラス変数の名前の配列を返します。
...を含みます。
//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, Kerne......l.#global_variables, Object#instance_variables, Module#constants... -
Module
# class _ exec(*args) {|*vars| . . . } -> object (27138.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...
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 (27138.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...
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 (27134.0) -
モジュールのコンテキストで文字列 expr またはモジュール自身をブロックパラメータとするブロックを 評価してその結果を返します。
...です。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ただし、ローカル変数は module_eval/class_eval の外側のスコープと共有します。
文字列が与えられた場合には、定数とクラス変数のスコープは自......などを差し替えることができます。
//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... -
Module
# class _ eval(expr , fname = "(eval)" , lineno = 1) -> object (27134.0) -
モジュールのコンテキストで文字列 expr またはモジュール自身をブロックパラメータとするブロックを 評価してその結果を返します。
...です。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ただし、ローカル変数は module_eval/class_eval の外側のスコープと共有します。
文字列が与えられた場合には、定数とクラス変数のスコープは自......などを差し替えることができます。
//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... -
Module
# module _ eval {|mod| . . . } -> object (27134.0) -
モジュールのコンテキストで文字列 expr またはモジュール自身をブロックパラメータとするブロックを 評価してその結果を返します。
...です。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ただし、ローカル変数は module_eval/class_eval の外側のスコープと共有します。
文字列が与えられた場合には、定数とクラス変数のスコープは自......などを差し替えることができます。
//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... -
Module
# module _ eval(expr , fname = "(eval)" , lineno = 1) -> object (27134.0) -
モジュールのコンテキストで文字列 expr またはモジュール自身をブロックパラメータとするブロックを 評価してその結果を返します。
...です。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ただし、ローカル変数は module_eval/class_eval の外側のスコープと共有します。
文字列が与えられた場合には、定数とクラス変数のスコープは自......などを差し替えることができます。
//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... -
Module
# class _ variable _ defined?(name) -> bool (27131.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
# private _ class _ method(*name) -> self (27126.0) -
name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を private に変更します。
...mes 0 個以上の String または Symbol を Array で指定します。
//emlist[例][ruby]{
module Foo
def self.foo; end
end
Foo.singleton_class.private_method_defined?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}... -
Module
# private _ class _ method(names) -> self (27126.0) -
name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を private に変更します。
...mes 0 個以上の String または Symbol を Array で指定します。
//emlist[例][ruby]{
module Foo
def self.foo; end
end
Foo.singleton_class.private_method_defined?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}... -
Module
# public _ class _ method(*name) -> self (27126.0) -
name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を public に変更します。
...0 個以上の String または Symbol を Array で指定します。
//emlist[例][ruby]{
class Foo
def self.foo
"foo"
end
private_class_method :foo
end
Foo.foo # NoMethodError: private method `foo' called for Foo:Class
Foo.public_class_method(:foo) # => Foo
Foo.foo # => "foo"
//}...