るりまサーチ

最速Rubyリファレンスマニュアル検索!
168件ヒット [101-168件を表示] (0.052秒)
トップページ > クエリ:end[x] > クエリ:singleton_method[x]

別のキーワード

  1. object define_singleton_method
  2. singleton dup
  3. singleton clone
  4. singleton instance
  5. _builtin define_singleton_method

検索結果

<< < 1 2 >>

クラス/メソッドの定義 (574.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...* nest_method
* eval_method
* singleton_method
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* defined

===[a:class] クラス定義

//emlist[例][ruby]{
class Foo < Super
def test
# ...
end

# ...
end

//}

文法:

class 識別...
...perclass ]
式..
end


文法:

class 識別子 [`<' superclass ]
式..
[rescue [error_type,..] [=> evar] [then]
式..]..
[else
式..]
[ensure
式..]
end


クラスを定義しま...
.../emlist[][ruby]{
class Foo < Array
def foo
end

end


# 定義を追加(スーパークラス Array を明示的に指定しても同じ)
class Foo
def bar
end

end


# 間違ったスーパークラスを指定するとエラー
class Foo < String
end

# => superclass mismatch for class Foo (Typ...

Numeric (54.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...o - - -
round | o o - - o o -
singleton_method
_added | o - - - - - -
size | - - o...
...floor
end

//}

また、任意桁の切上げ、切捨て、四捨五入を行うメソッドは以下のように
定義できます。

//emlist[][ruby]{
class Numeric
def roundup(d=0)
x = 10**d
if self > 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end

end
...
...f < 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end

end


def roundoff(d=0)
x = 10**d
if self < 0
(self.quo(x) - 0.5).ceil * x
else
(self.quo(x) + 0.5).floor * x
end

end

end

//}


===[a:division] 除法と商・剰余

Numeric には除法...
...remainder | o o - - -
round | o o o o -
singleton_method
_added | o - - - -
size | - o - - -...

NEWS for Ruby 2.1.0 (48.0)

NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ence としてサポートしました??
* 拡張: IO#seek 第2引数としてシンボルを受け付けるようになりました (:CUR, :END, :SET, :DATA, :HOLE)
* 拡張: IO#read_nonblock シンボルを返すためにキーワード引数 `exception: false` を受け付けるよう...
...すためにキーワード引数 `exception: false` を受け付けるようになりました

* Kernel
* 追加: Kernel#singleton_method(Object#singleton_method)

* Module
* 追加: Module#using, which activates refinements of the specified module only
in the current class or mo...
...se を返します。
* 拡張: Module#refine はもはや実験的な機能でなくなりました
* 拡張: Module#include と Module#prepend はパブリックメソッドになりました

* Mutex
* Mutex#owned? はもはや実験的な機能ではありません。

* Numeric...

Module#method_undefined(name) -> () (30.0)

このモジュールのインスタンスメソッド name が Module#undef_method によって削除されるか、 undef 文により未定義にされると、インタプリタがこのメソッドを呼び出します。

...BasicObject#singleton_method_undefined
を使います。

@param name 削除/未定義にされたメソッド名が Symbol で渡されます。

//emlist[例][ruby]{
class C
def C.method_undefined(name)
puts "method C\##{name} was undefined"
end


def foo
end

def bar
end


undef_m...
...ethod :foo
undef bar
end

//}

実行結果:

method C#foo was undefined
method C#bar was undefined...

Module#method_added(name) -> () (24.0)

メソッド name が追加された時にインタプリタがこのメソッドを呼び出します。

...ct#singleton_method_added
を使います。

@param name 追加されたメソッドの名前が Symbol で渡されます。

//emlist[例][ruby]{
class Foo
def Foo.method_added(name)
puts "method \"#{name}\" was added"
end


def foo
end

define_method :bar, instance_method(:foo)
end
...

絞り込み条件を変える

Module#method_removed(name) -> () (24.0)

メソッドが 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 "...
<< < 1 2 >>