187件ヒット
[1-100件を表示]
(0.087秒)
種類
- インスタンスメソッド (132)
- モジュール関数 (44)
- 特異メソッド (11)
クラス
- BasicObject (33)
- Module (33)
- Object (66)
モジュール
- Math (44)
オブジェクト
- main (11)
キーワード
- asin (11)
- asinh (11)
-
const
_ missing (11) -
define
_ singleton _ method (22) -
respond
_ to _ missing? (11) -
singleton
_ class (11) -
singleton
_ class? (11) -
singleton
_ method (11) -
singleton
_ method _ added (11) -
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) - sinh (11)
- using (22)
検索結果
先頭5件
-
Math
. # sin(x) -> Float (18209.0) -
x の正弦関数(sine)の値を返します。
...関数(sine)の値を返します。
@param x 実数(ラジアンで与えます)
@return [-1, 1] の実数
@raise TypeError x に数値以外を指定した場合に発生します。
@raise RangeError x に実数以外の数値を指定した場合に発生します。
//emlist[例][r......uby]{
Math.sin(Math::PI/2) # => 1.0
//}
@see Math.#asin... -
Module
# singleton _ class? -> bool (15202.0) -
self が特異クラスの場合に true を返します。そうでなければ false を返し ます。
...self が特異クラスの場合に true を返します。そうでなければ false を返し
ます。
//emlist[例][ruby]{
class C
end
C.singleton_class? # => false
C.singleton_class.singleton_class? # => true
//}... -
BasicObject
# singleton _ method _ added(name) -> object (12202.0) -
特異メソッドが追加された時にインタプリタから呼び出されます。
...には
Module#method_addedを使います。
@param name 追加されたメソッド名が Symbol で渡されます。
//emlist[例][ruby]{
class Foo
def singleton_method_added(name)
puts "singleton method \"#{name}\" was added"
end
end
obj = Foo.new
def obj.foo
end
#=> singleton method......"foo" was added
//}
@see Module#method_added,BasicObject#singleton_method_removed,BasicObject#singleton_method_undefined... -
BasicObject
# singleton _ method _ removed(name) -> object (12202.0) -
特異メソッドが Module#remove_method に より削除された時にインタプリタから呼び出されます。
...dule#remove_method に
より削除された時にインタプリタから呼び出されます。
通常のメソッドの削除に対するフックには
Module#method_removedを使います。
@param name 削除されたメソッド名が Symbol で渡されます。
//emlist[例][ruby]{
clas......def singleton_method_removed(name)
puts "singleton method \"#{name}\" was removed"
end
end
obj = Foo.new
def obj.foo
end
class << obj
remove_method :foo
end
#=> singleton method "foo" was removed
//}
@see Module#method_removed,BasicObject#singleton_method_added,BasicObject#singleton_m... -
BasicObject
# singleton _ method _ undefined(name) -> object (12202.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...が Module#undef_method または
undef により未定義にされた時にインタプリタから呼び出されます。
通常のメソッドの未定義に対するフックには
Module#method_undefined を使います。
@param name 未定義にされたメソッド名が Symbol で渡さ......emlist[例][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
# singlet......on method "bar" was undefined
//}
@see Module#method_undefined,BasicObject#singleton_method_added,BasicObject#singleton_method_removed , d:spec/def#undef... -
Object
# define _ singleton _ method(symbol) { . . . } -> Symbol (12202.0) -
self に特異メソッド name を定義します。
...self に特異メソッド name を定義します。
@param symbol メソッド名を String または Symbol で指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Sy......mbol を返します。
//emlist[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"
guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello......#=> "Bob: Hello there!"
//}... -
Object
# define _ singleton _ method(symbol , method) -> Symbol (12202.0) -
self に特異メソッド name を定義します。
...self に特異メソッド name を定義します。
@param symbol メソッド名を String または Symbol で指定します。
@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。
@return メソッド名を表す Sy......mbol を返します。
//emlist[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"
guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello......#=> "Bob: Hello there!"
//}... -
Object
# singleton _ class -> Class (12202.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
...が nil か true か false なら、それぞれ NilClass, TrueClass,
FalseClass を返します。
@raise TypeError レシーバが Integer、Float、Symbol の場合に発生します。
//emlist[][ruby]{
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
String.singleton_class #......=> #<Class:String>
nil.singleton_class #=> NilClass
//}
@see Object#class... -
Object
# singleton _ method(name) -> Method (12202.0) -
オブジェクトの特異メソッド name をオブジェクト化した Method オブ ジェクトを返します。
...aram name メソッド名をSymbol またはStringで指定します。
@raise NameError 定義されていないメソッド名を引数として与えると発生します。
//emlist[][ruby]{
class Demo
def initialize(n)
@iv = n
end
def hello()
"Hello, @iv = #{@iv}"
end
end
k =......o.new(99)
def k.hi
"Hi, @iv = #{@iv}"
end
m = k.singleton_method(:hi) # => #<Method: #<Demo:0xf8b0c3c4 @iv=99>.hi>
m.call #=> "Hi, @iv = 99"
m = k.singleton_method(:hello) # => NameError
//}
@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#method... -
Object
# singleton _ methods(inherited _ too = true) -> [Symbol] (12202.0) -
そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。
...メソッド名
(public あるいは protected メソッド) の一覧を返します。
inherited_too が真のときは継承した特異メソッドを含みます。
継承した特異メソッドとは Object#extend によって追加された特異メソッドや、
self がクラスの場合......(Classのインスタンスの特異メソッド)などです。
singleton_methods(false) は、Object#methods(false) と同じです。
@param inherited_too 継承した特異メソッドを含める場合は真を、
そうでない場合は偽を指定します。
//emlist......t = Class.new
class <<Parent
private; def private_class_parent() end
protected; def protected_class_parent() end
public; def public_class_parent() end
end
Foo = Class.new(Parent)
class <<Foo
private; def private_class_foo() end
protected; def protected_class_foo() end
public;...