るりまサーチ

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

別のキーワード

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

検索結果

Object#singleton_method(name) -> Method (18119.0)

オブジェクトの特異メソッド name をオブジェクト化した Method オブ ジェクトを返します。

...y]{
class Demo
def initialize(n)
@iv = n
end
def hello()
"Hello, @iv = #{@iv}"
end
end

k = Demo.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) # => NameE...

1.6.8から1.8.0への変更点(まとめ) (66.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...(({ary[n,0] = [other,...]})) と同じ(ただし self を返す)

=== Class

: ((<Class#allocate|Class/allocate>)) [new]

allocate と initialize の二つのメソッドでオブジェクトを
生成するようになりました。((<ruby-dev:14847>))
rb_define_alloc_func() も...
...dError

: ((<NoMethodError#args|NoMethodError/args>)) [new]

追加

=== Object

: ((<Object#initialize_copy|Object/initialize_copy>)) [change]

追加

このメソッドは initialize と同様、自動的に private method になります。

: ((<Object#instance_variable_get|Object/...
...object_id|Object/object_id>)) [new]

追加 (Object#id は、obsolete)

: ((<Object#singleton_method_removed|Object/singleton_method_removed>)) [new]
: ((<Object#singleton_method_undefined|Object/singleton_method_undefined>)) [new]

追加

=== Proc

: ((<Proc#binding|Proc/binding>)) [new]...

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

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

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

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

//emlist[...
...//emlist[例][ruby]{
class Vector2D
attr_accessor :x, :y # インスタンス変数@x, @yに対応するゲッタとセッタを定義
def initialize(x, y) # コンストラクタ
@x = x; @y = y # @がつくのがインスタンス変数(メンバ変数)
end
def ==(other_vec)...
...foo は未定義
def foo
print "foo\n"
end
//}

は未定義メソッドの呼び出しで例外 NameError を発生させます。

===[a:singleton_method] 特異メソッド定義

//emlist[例][ruby]{
def foo.test
print "this is foo\n"
end
//}

文法:

def 式 `.' 識別子 [`(' [...

Profiler__ (12.0)

プロファイラの実装です。 Profiler__.start_profile 実行から、Profiler__.stop_profile までの 区間の実行コードのプロファイルを取得します。

...l name
51.64 1.10 1.10 3 366.67 776.67 Kernel.require
17.37 1.47 0.37 1 370.00 370.00 TclTkIp#initialize
8.92 1.66 0.19 514 0.37 0.37 Module#method_added
6.57 1.80 0.14 1 140.00 140.00 Profiler__...
...3.29 1.96 0.07 15 4.67 4.67 Module#extend_object
3.29 2.03 0.07 133 0.53 0.53 Kernel.singleton_method_added
2.82 2.09 0.06 28 2.14 2.86 Module#attr
1.88 2.13 0.04 19 2.11 2.11 Module#pr...