クラス
- BasicObject (11)
- Enumerator (44)
-
Enumerator
:: Lazy (44) - Method (74)
- Module (343)
- Object (132)
- Proc (16)
- Refinement (3)
-
RubyVM
:: InstructionSequence (66) - String (33)
- UnboundMethod (163)
キーワード
- == (11)
-
absolute
_ path (11) -
alias
_ method (11) - arity (22)
-
base
_ label (11) - bind (11)
-
bind
_ call (10) -
class
_ exec (11) - clone (11)
- curry (20)
-
define
_ method (22) - each (44)
- encode (33)
-
enum
_ for (44) - eql? (11)
-
first
_ lineno (11) - hash (11)
-
import
_ methods (3) - inspect (11)
-
instance
_ method (11) -
instance
_ methods (11) - label (11)
-
method
_ added (11) -
method
_ defined? (11) -
method
_ removed (11) -
method
_ undefined (11) - methods (11)
-
module
_ exec (11) -
module
_ function (19) - name (11)
-
original
_ name (11) - owner (22)
- parameters (11)
- path (11)
- private (23)
-
private
_ class _ method (15) -
private
_ instance _ methods (11) -
private
_ method _ defined? (11) -
private
_ methods (11) - protected (23)
-
protected
_ instance _ methods (11) -
protected
_ method _ defined? (11) -
protected
_ methods (11) - public (23)
-
public
_ class _ method (15) -
public
_ instance _ method (11) -
public
_ instance _ methods (11) -
public
_ method (11) -
public
_ method _ defined? (11) -
public
_ methods (11) -
remove
_ method (11) -
respond
_ to? (11) -
respond
_ to _ missing? (11) -
ruby2
_ keywords (10) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) -
source
_ location (33) -
super
_ method (20) -
to
_ a (11) -
to
_ enum (44) -
to
_ s (11) - unbind (11)
-
undef
_ method (11)
検索結果
先頭5件
-
Method
# super _ method -> Method | nil (21381.0) -
self 内で super を実行した際に実行されるメソッドを Method オブジェ クトにして返します。
...super を実行した際に実行されるメソッドを Method オブジェ
クトにして返します。
@see UnboundMethod#super_method
//emlist[例][ruby]{
class Super
def foo
"superclass method"
end
end
class Sub < Super
def foo
"subclass method"
end
end
m = Sub.new.method......(:foo) # => #<Method: Sub#foo>
m.call # => "subclass method"
m.super_method # => #<Method: Super#foo>
m.super_method.call # => "superclass method"
//}... -
UnboundMethod
# super _ method -> UnboundMethod | nil (18316.0) -
self 内で super を実行した際に実行されるメソッドを UnboundMethod オブジェ クトにして返します。
...self 内で super を実行した際に実行されるメソッドを UnboundMethod オブジェ
クトにして返します。
@see Method#super_method... -
Method
# unbind -> UnboundMethod (15433.0) -
self のレシーバとの関連を取り除いた UnboundMethod オブ ジェクトを生成して返します。
...り除いた UnboundMethod オブ
ジェクトを生成して返します。
//emlist[例][ruby]{
class Foo
def foo
"foo"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
unbound_method = m.unbind # => #<UnboundMethod: Foo#foo>
unbound_method.bind(Foo.new) # => #<Method: Foo#foo>
/... -
Method
# source _ location -> [String , Integer] | nil (15121.0) -
ソースコードのファイル名と行番号を配列で返します。
...トが ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。
@see Proc#source_location
//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
end
# ----- end of /tmp/foo.rb ----
require '/tmp/foo'
m = Foo.new.method(:foo) # =>......#<Method: Foo#foo>
m.source_location # => ["/tmp/foo.rb", 2]
method(:puts).source_location # => nil
//}... -
Method
# curry -> Proc (15115.0) -
self を元にカリー化した Proc を返します。
...要があります。
//emlist[例][ruby]{
def foo(a,b,c)
[a, b, c]
end
proc = self.method(:foo).curry
proc2 = proc.call(1, 2) #=> #<Proc>
proc2.call(3) #=> [1,2,3]
def vararg(*args)
args
end
proc = self.method(:vararg).curry(4)
proc2 = proc.call(:x) #=> #<P......roc>
proc3 = proc2.call(:y, :z) #=> #<Proc>
proc3.call(:a) #=> [:x, :y, :z, :a]
//}
@see Proc#curry... -
Method
# curry(arity) -> Proc (15115.0) -
self を元にカリー化した Proc を返します。
...要があります。
//emlist[例][ruby]{
def foo(a,b,c)
[a, b, c]
end
proc = self.method(:foo).curry
proc2 = proc.call(1, 2) #=> #<Proc>
proc2.call(3) #=> [1,2,3]
def vararg(*args)
args
end
proc = self.method(:vararg).curry(4)
proc2 = proc.call(:x) #=> #<P......roc>
proc3 = proc2.call(:y, :z) #=> #<Proc>
proc3.call(:a) #=> [:x, :y, :z, :a]
//}
@see Proc#curry... -
Object
# public _ method(name) -> Method (12357.0) -
オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。
...オブジェクトの public メソッド name をオブジェクト化した
Method オブジェクトを返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、......vate メソッド名を引数として与えると発生します。
//emlist[][ruby]{
1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}
@see Object#method,Object#public_send,Module#public_instance_method... -
Module
# public _ instance _ method(name) -> UnboundMethod (12334.0) -
self の public インスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...self の public インスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、 priva......として与えると発生します。
//emlist[例][ruby]{
Kernel.public_instance_method(:object_id) #=> #<UnboundMethod: Kernel#object_id>
Kernel.public_instance_method(:p) # method `p' for module `Kernel' is private (NameError)
//}
@see Module#instance_method,Object#public_method... -
Module
# public _ method _ defined?(name , inherit=true) -> bool (12312.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が public であるときに true を返します。 そうでなければ false を返します。
...ており、
しかもその可視性が public であるときに true を返します。
そうでなければ false を返します。
@param name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジュールで
定義......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
include A
def method3() end
end
A.method_defined? :method1 #=> true
C.publi......c_method_defined? "method1" #=> true
C.public_method_defined? "method1", true #=> true
C.public_method_defined? "method1", false #=> true
C.public_method_defined? "method2" #=> false
C.method_defined? "method2" #=> true
//}... -
Module
# public _ method _ defined?(name) -> bool (12288.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が public であるときに true を返します。 そうでなければ false を返します。
...が public であるときに true を返します。
そうでなければ false を返します。
@param name Symbol か String を指定します。
@see Module#method_defined?, Module#private_method_defined?, Module#protected_method_defined?
//emlist[例][ruby]{
module A
def method1() end......protected
def method2() end
end
class C < B
include A
def method3() end
end
A.method_defined? :method1 #=> true
C.public_method_defined? "method1" #=> true
C.public_method_defined? "method2" #=> false
C.method_defined? "method2" #=> true
//}... -
BasicObject
# singleton _ method _ undefined(name) -> object (12274.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...特異メソッドが Module#undef_method または
undef により未定義にされた時にインタプリタから呼び出されます。
通常のメソッドの未定義に対するフックには
Module#method_undefined を使います。
@param name 未定義にされたメソッド名......[ruby]{
class Foo
def singleton_method_undefined(name)
puts "singleton method \"#{name}\" was undefined"
end
end
obj = Foo.new
def obj.foo
end
def obj.bar
end
class << obj
undef_method :foo
end
obj.instance_eval {undef bar}
#=> singleton method "foo" was undefined
# singleton method "......bar" was undefined
//}
@see Module#method_undefined,BasicObject#singleton_method_added,BasicObject#singleton_method_removed , d:spec/def#undef...