るりまサーチ

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

別のキーワード

  1. win32ole ole_activex_initialize
  2. ri initialize
  3. object initialize
  4. darkfish initialize
  5. _builtin initialize

ライブラリ

キーワード

検索結果

MonitorMixin (25.0)

スレッドの同期機構としてのモニター機能を提供するモジュールです。

...スレッドの同期機構としてのモニター機能を提供するモジュールです。

クラスに Module#include したり、オブジェクトに
Object#extend したりすることでそのクラス/オブジェクトに
モニタ機能を追加します。

=== 例

//emlist[消費...
.../}

しかし、MonitorMixin をクラス定義の際に Module#include を使って
利用する場合は、initialize メソッドで super() か super を呼んで、初期化する必要があります。
スーパークラスの initialize に引数を渡したい場合は super を、そうで...
...クラスは Object であり、その initialize は引数を受け付けないので
super ではなく super() を呼ぶ必要があります。

//emlist[include する例][ruby]{
require 'monitor'

class MyObject
include MonitorMixin

def initialize(val)
super()
@value = val
end...

Observable (13.0)

Observer パターンを提供するモジュールです。

...=== サンプルコード
require "observer"

class Ticker ### Periodically fetch a stock price.
include Observable

def initialize(symbol)
@symbol = symbol
end

def run
last_price = nil
loop do
price = Price.fetch(@symbol)
print "Curr...
...- 140).
def self.fetch(symbol)
60 + rand(80)
end
end

class Warner ### An abstract observer of Ticker objects.
def initialize(ticker, limit)
@limit = limit
ticker.add_observer(self)
end
end

class WarnLow < Warner
def update(time, price) #...

Profiler__ (7.0)

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

...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__.start_profile
4.23 1.8...
...0.06 28 2.14 2.86 Module#attr
1.88 2.13 0.04 19 2.11 2.11 Module#private
1.41 2.16 0.03 29 1.03 1.38 Module#include
0.94 2.18 0.02 10 2.00 4.00 Module#module_function
0.94 2.20 0....

Sync_m (7.0)

スレッド同期機構である再入可能な reader/writer ロック機能を Mix-in により提供します。

...スレッド同期機構である再入可能な reader/writer ロック機能を Mix-in により提供します。

includeしたクラスではinitializeでsuperを呼び出しておく必要があります。...