ライブラリ
- ビルトイン (1597)
- erb (12)
-
fiddle
/ import (84) -
irb
/ context (12) -
minitest
/ spec (1) -
minitest
/ unit (1) - psych (8)
- rake (12)
-
rdoc
/ code _ object (12) -
rdoc
/ context (108) -
rdoc
/ stats (24) -
rdoc
/ top _ level (36) - win32ole (24)
クラス
- BasicObject (72)
- ERB (12)
-
Enumerator
:: Lazy (48) -
IRB
:: Context (12) - Method (36)
- Module (1116)
- Object (240)
- Proc (18)
-
RDoc
:: CodeObject (12) -
RDoc
:: Context (108) -
RDoc
:: Stats (24) -
RDoc
:: TopLevel (36) - Refinement (4)
- TracePoint (12)
- UnboundMethod (24)
-
WIN32OLE
_ TYPE (24)
モジュール
- Enumerable (48)
-
Fiddle
:: Importer (84) -
MiniTest
:: Assertions (1)
キーワード
- < (12)
- <= (12)
- <=> (12)
- === (24)
- > (12)
- >= (12)
-
add
_ class _ or _ module (24) -
add
_ module (12) -
alias
_ method (12) - ancestors (12)
-
append
_ features (12) -
assert
_ instance _ of (1) - attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) - autoload (12)
- autoload? (12)
- bind (24)
- class (12)
-
class
_ eval (24) -
class
_ exec (12) -
class
_ variable _ defined? (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) -
class
_ variables (12) -
const
_ added (3) -
const
_ defined? (12) -
const
_ get (12) -
const
_ missing (12) -
const
_ set (12) -
const
_ source _ location (12) - constants (12)
-
create
_ value (12) -
def
_ module (12) -
default
_ event _ sources (12) -
define
_ method (24) -
defined
_ class (12) -
deprecate
_ constant (12) -
each
_ classmodule (12) -
enum
_ for (48) - extend (12)
-
extend
_ object (12) - extended (12)
- extern (12)
-
find
_ enclosing _ module _ named (12) -
find
_ local _ symbol (24) -
find
_ module _ named (24) -
find
_ symbol (12) - freeze (12)
-
import
_ methods (4) - include (12)
- include? (12)
- included (12)
-
included
_ modules (12) -
infect
_ with _ assertions (1) -
initialize
_ classes _ and _ modules (12) - inspect (24)
-
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ method (12) -
instance
_ methods (12) -
instance
_ variables (12) -
is
_ a? (12) -
kind
_ of? (12) - lambda? (12)
-
load
_ modules (12) -
max
_ by (48) - method (12)
-
method
_ added (12) -
method
_ defined? (12) -
method
_ removed (12) -
method
_ undefined (12) - methods (12)
-
module
_ eval (24) -
module
_ exec (12) -
module
_ function (36) - modules (12)
- name (12)
-
num
_ modules (12) -
num
_ modules= (12) -
ole
_ type (12) - owner (24)
- prepend (12)
-
prepend
_ features (12) - prepended (12)
- private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) -
private
_ methods (12) - protected (48)
-
protected
_ instance _ methods (12) -
protected
_ method _ defined? (12) -
protected
_ methods (12) -
psych
_ yaml _ as (4) - public (48)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ instance _ methods (12) -
public
_ method (12) -
public
_ method _ defined? (12) -
public
_ methods (12) -
rake
_ extension (12) - refine (12)
-
remove
_ class _ variable (12) -
remove
_ classes _ and _ modules (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
remove
_ method (12) -
respond
_ to? (12) -
ruby2
_ keywords (18) -
singleton
_ class? (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) - sizeof (12)
- struct (12)
-
to
_ enum (48) -
to
_ s (24) -
undef
_ method (12) - union (12)
- using (12)
- value (12)
-
yaml
_ as (4)
検索結果
先頭5件
-
Module
# protected _ method _ defined?(name , inherit=true) -> bool (21025.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が protected であるときに true を返します。 そうでなければ false を返します。
...したモジュールで
定義されたメソッドも対象になります。
@see Module#method_defined?, Module#public_method_defined?, Module#private_method_defined?
//emlist[例][ruby]{
module A
def method1() end
end
class B
protected
def method2() end
end
class C < B
inclu... -
Module
# public _ method _ defined?(name , inherit=true) -> bool (21025.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が public であるときに true を返します。 そうでなければ false を返します。
...たモジュールで
定義されたメソッドも対象になります。
@see Module#method_defined?, Module#private_method_defined?, Module#protected_method_defined?
//emlist[例][ruby]{
module A
def method1() end
end
class B
protected
def method2() end
end
class C < B
includ... -
Module
# class _ exec(*args) {|*vars| . . . } -> object (21020.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...ing.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
# freeze -> self (21019.0) -
モジュールを凍結(内容の変更を禁止)します。
...。
凍結したモジュールにメソッドの追加など何らかの変更を加えようとした場合に
FrozenError
が発生します。
@see Object#freeze
//emlist[例][ruby]{
module Foo; end
Foo.freeze
module Foo
def foo; end
end # => FrozenError: can't modify frozen module
//}... -
Module
# private _ instance _ methods(inherited _ too = true) -> [Symbol] (21019.0) -
そのモジュールで定義されている private メソッド名 の一覧を配列で返します。
...ュールで定義されているメソッドのみ返します。
@see Object#private_methods, Module#instance_methods
//emlist[例][ruby]{
module Foo
def foo; end
private def bar; end
end
module Bar
include Foo
def baz; end
private def qux; end
end
Bar.private_instance_methods # =>... -
Module
# public _ constant(*name) -> self (21019.0) -
name で指定した定数の可視性を public に変更します。
...][ruby]{
module SampleModule
class SampleInnerClass
end
# => 非公開クラスであることを明示するために private にする
private_constant :SampleInnerClass
end
begin
SampleModule::SampleInnerClass
rescue => e
e # => #<NameError: private constant SampleModule::SampleInne......rClass referenced>
end
module SampleModule
# => 非公開クラスであることは承知で利用するために public にする
public_constant :SampleInnerClass
end
SampleModule::SampleInnerClass # => SampleModule::SampleInnerClass
//}
@see Module#private_constant, Object#untrusted?......rClass referenced>
end
module SampleModule
# => 非公開クラスであることは承知で利用するために public にする
public_constant :SampleInnerClass
end
SampleModule::SampleInnerClass # => SampleModule::SampleInnerClass
//}
@see Module#private_constant... -
Module
# method _ removed(name) -> () (21017.0) -
メソッドが Module#remove_method により削除 された時にインタプリタがこのメソッドを呼び出します。
...メソッドが Module#remove_method により削除
された時にインタプリタがこのメソッドを呼び出します。
特異メソッドの削除に対するフックには
BasicObject#singleton_method_removed
を使います。
@param name 削除されたメソッド名が Symbol... -
Module
# method _ undefined(name) -> () (21017.0) -
このモジュールのインスタンスメソッド name が Module#undef_method によって削除されるか、 undef 文により未定義にされると、インタプリタがこのメソッドを呼び出します。
...このモジュールのインスタンスメソッド name が
Module#undef_method によって削除されるか、
undef 文により未定義にされると、インタプリタがこのメソッドを呼び出します。
特異メソッドの削除をフックするには
BasicObject#singlet... -
Module
# class _ eval {|mod| . . . } -> object (21015.0) -
モジュールのコンテキストで文字列 expr またはモジュール自身をブロックパラメータとするブロックを 評価してその結果を返します。
...ことです。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ただし、ローカル変数は module_eval/class_eval の外側のスコープと共有します。
定数とクラス変数のスコープは、文字列が与えられた場合と......列が渡された場合は、モジュール定義式内と同じスコープになる。つまり、この場合は
# class C
# X = 2
# end
# と書いたのと同じ意味になる。
C.class_eval 'X = 2'
p X #=> 1
p C::X #=> 2
//}
@see BasicObject#instance_eval, Module.new, Kernel.#eval...