720件ヒット
[301-400件を表示]
(0.107秒)
別のキーワード
ライブラリ
- ビルトイン (720)
キーワード
- < (12)
- <= (12)
- <=> (12)
- > (12)
- >= (12)
-
alias
_ method (12) - ancestors (12)
-
append
_ features (12) - attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) - autoload (12)
- autoload? (12)
-
class
_ eval (12) -
class
_ exec (12) -
class
_ variable _ defined? (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) -
class
_ variables (12) -
const
_ defined? (12) -
const
_ get (12) -
const
_ source _ location (12) - constants (12)
-
deprecate
_ constant (12) - freeze (12)
- included (12)
- inspect (12)
-
instance
_ methods (12) -
method
_ defined? (12) -
method
_ removed (12) -
module
_ eval (12) -
module
_ exec (12) -
module
_ function (24) - name (12)
- prepend (12)
-
prepend
_ features (12) - prepended (12)
- private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) - public (36)
-
public
_ method _ defined? (12) - refine (12)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ method (12) -
to
_ s (12)
検索結果
先頭5件
-
Module
# prepended(class _ or _ module) -> () (6120.0) -
self が Module#prepend されたときに対象のクラスまたはモジュールを 引数にしてインタプリタがこのメソッドを呼び出します。
...self が Module#prepend されたときに対象のクラスまたはモジュールを
引数にしてインタプリタがこのメソッドを呼び出します。
@param class_or_module Module#prepend を実行したオブジェクト
//emlist[例][ruby]{
module A
def self.prepended(mod)......puts "#{self} prepended to #{mod}"
end
end
module Enumerable
prepend A
end
# => "A prepended to Enumerable"
//}
@see Module#included, Module#prepend, Module#prepend_features... -
Module
# private _ class _ method(*name) -> self (6120.0) -
name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を private に変更します。
...可視性を private に変更します。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
//emlist[例][ruby]{
module Foo
def self.foo; end
end
Foo.singleton_class.private_method_defi......ned?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}... -
Module
# private _ class _ method(names) -> self (6120.0) -
name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を private に変更します。
...可視性を private に変更します。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
//emlist[例][ruby]{
module Foo
def self.foo; end
end
Foo.singleton_class.private_method_defi......ned?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}... -
Module
# ancestors -> [Class , Module] (6114.0) -
クラス、モジュールのスーパークラスとインクルードしているモジュール を優先順位順に配列に格納して返します。
...先順位順に配列に格納して返します。
//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
p ancestors
p included_modules
p superclass
end
# => [Baz, Bar, Foo, Object, Kernel, BasicObject]
# => [Foo, Kernel]
# => Bar
//}
@see Module#included_modules... -
Module
# class _ variable _ defined?(name) -> bool (6114.0) -
name で与えられた名前のクラス変数がモジュールに存在する場合 true を 返します。
...合 true を
返します。
@param 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
# class _ variable _ set(name , val) -> object (6114.0) -
クラス/モジュールにクラス変数 name を定義して、その値として 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) # => 101
p Fred.new.foo # => 101
//}... -
Module
# freeze -> self (6114.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
# method _ removed(name) -> () (6114.0) -
メソッドが Module#remove_method により削除 された時にインタプリタがこのメソッドを呼び出します。
...メソッドが Module#remove_method により削除
された時にインタプリタがこのメソッドを呼び出します。
特異メソッドの削除に対するフックには
BasicObject#singleton_method_removed
を使います。
@param name 削除されたメソッド名が Symbol......で渡されます。
//emlist[例][ruby]{
class Foo
def Foo.method_removed(name)
puts "method \"#{name}\" was removed"
end
def foo
end
remove_method :foo
end
# => method "foo" was removed
//}... -
Module
# alias _ method(new , original) -> Symbol (138.0) -
メソッドの別名を定義します。
...メソッドの別名を定義します。
//emlist[例][ruby]{
module Kernel
alias_method :hoge, :puts # => :hoge
alias_method "foo", :puts # => :foo
end
//}
alias との違いは以下の通りです。
* メソッド名は String または Symbol で指定します
* グローバル......できません。
@param new 新しいメソッド名。String または Symbol で指定します。
@param original 元のメソッド名。String または Symbol で指定します。
@return 作成したエイリアスのメソッド名を表す Symbol を返します。
@see d:spec/def#al......ias
//emlist[例][ruby]{
module Kernel
alias_method :foo, :puts
end
foo "bar" # bar
//}...