キーワード
-
alias
_ method (12) -
class
_ exec (12) -
define
_ method (24) -
instance
_ method (12) -
instance
_ methods (12) -
method
_ added (12) -
method
_ defined? (12) -
method
_ removed (12) -
method
_ undefined (12) -
module
_ exec (12) -
module
_ function (36) - private (48)
-
private
_ class _ method (24) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) - protected (48)
-
protected
_ instance _ methods (12) -
protected
_ method _ defined? (12) -
psych
_ yaml _ as (4) - public (48)
-
public
_ class _ method (24) -
public
_ instance _ method (12) -
public
_ instance _ methods (12) -
public
_ method _ defined? (12) -
rake
_ extension (12) -
remove
_ method (12) -
ruby2
_ keywords (12) -
undef
_ method (12) -
yaml
_ as (4)
検索結果
先頭5件
-
Module
# module _ exec(*args) {|*vars| . . . } -> object (24127.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
# ruby2 _ keywords(method _ name , . . . ) -> nil (21257.0) -
For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.
...For the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword argument......other method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through the method to
other methods.
This should only be used for methods that delegate keywords to another
method, an.......7.
This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the module responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
method will ch... -
Module
# rake _ extension(method) { . . . } -> () (21109.0) -
与えられたブロック内で既に存在するメソッドを再定義しようとした場合に 警告を表示します。この場合、ブロックは評価されません。
...するメソッドを再定義しようとした場合に
警告を表示します。この場合、ブロックは評価されません。
@param method ブロック内で再定義する予定のメソッド名を指定します。
例:
class String
rake_extension("xyz") do
def xyz... -
Module
# class _ exec(*args) {|*vars| . . . } -> object (21027.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
# protected() -> nil (21014.0) -
メソッドを protected に設定します。
...い。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定した場合に発生します。
@see Module#protected_method_defined?... -
Module
# protected(*name) -> Array (21014.0) -
メソッドを protected に設定します。
...い。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定した場合に発生します。
@see Module#protected_method_defined?... -
Module
# protected(name) -> String | Symbol (21014.0) -
メソッドを protected に設定します。
...い。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定した場合に発生します。
@see Module#protected_method_defined?... -
Module
# protected(names) -> Array (21014.0) -
メソッドを protected に設定します。
...い。
@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。
@raise NameError 存在しないメソッド名を指定した場合に発生します。
@see Module#protected_method_defined?... -
Module
# private() -> nil (21008.0) -
メソッドを private に設定します。
...) 1 end # デフォルトでは public
private # 可視性を private に変更
def foo2() 2 end # foo2 は private メソッド
end
foo = Foo.new
p foo.foo1 # => 1
p foo.foo2 # => private method `foo2' called for #<Foo:0x401b7628> (NoMethodError)
//}...