るりまサーチ

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

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

キーワード

検索結果

MonitorMixin (13.0)

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

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

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

=== 例

//emlist[消費...
...//emlist[extend する例][ruby]{
require 'monitor'
buf = []
buf.extend(MonitorMixin)
//}

しかし、MonitorMixin をクラス定義の際に Module#include を使って
利用する場合は、initialize メソッドで super() か super を呼んで、初期化する必要があります。...
...必要があります。

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

class MyObject
include MonitorMixin

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

def to_s
synchronize {
@value.to_s
}
end
end
//}

以下も参考になります。

* 9384
* 9386...

Observable (13.0)

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

...if price < @limit
print "--- #{time.to_s}: Price below #@limit: #{price}\n"
end
end
end

class WarnHigh < Warner
def update(time, price) # callback for observer
if price > @limit
print "+++ #{time.to_s}: Price above #@limit: #{price}\n"
end...