別のキーワード
ライブラリ
- ビルトイン (30)
-
fiddle
/ import (11) - forwardable (22)
-
irb
/ ext / save-history (11) -
irb
/ extend-command (22) - json (22)
- monitor (11)
-
mutex
_ m (11) - open-uri (11)
- optparse (11)
- profiler (6)
キーワード
- Arguable (11)
- ContextExtender (11)
- ExtendCommandBundle (11)
- Forwardable (11)
- HistorySavingAbility (11)
- Importer (11)
- Meta (11)
- MonitorMixin (11)
-
Mutex
_ m (11) -
Profiler
_ _ (6) - SingleForwardable (11)
- WaitReadable (11)
- WaitWritable (11)
- Warning (8)
検索結果
先頭5件
-
JSON
:: Ext :: Generator :: GeneratorMethods :: String :: Extend (18017.0) -
Alias of JSON::Generator::GeneratorMethods::String::Extend
...Alias of JSON::Generator::GeneratorMethods::String::Extend... -
JSON
:: Generator :: GeneratorMethods :: String :: Extend (18001.0) -
String に JSON で使用する特異メソッドを追加するためのモジュールです。
String に JSON で使用する特異メソッドを追加するためのモジュールです。 -
IRB
:: ContextExtender (6001.0) -
IRB::Context を拡張するためのモジュールです。
IRB::Context を拡張するためのモジュールです。 -
IRB
:: ExtendCommandBundle (6001.0) -
irb のコマンドを拡張するためのモジュールです。
irb のコマンドを拡張するためのモジュールです。 -
MonitorMixin (31.0)
-
スレッドの同期機構としてのモニター機能を提供するモジュールです。
...。
クラスに Module#include したり、オブジェクトに
Object#extend したりすることでそのクラス/オブジェクトに
モニタ機能を追加します。
=== 例
//emlist[消費者、生産者問題の例][ruby]{
require 'monitor'
buf = []
buf.extend(MonitorMixin) # 配......す。
上の例のように Object#extend を使って利用する場合は
自動的に初期化されます。
//emlist[extend する例][ruby]{
require 'monitor'
buf = []
buf.extend(MonitorMixin)
//}
しかし、MonitorMixin をクラス定義の際に Module#include を使って
利用する... -
Mutex
_ m (29.0) -
スレッド同期機構である Thread::Mutex のモジュール版です。クラスに Module#include することでそのクラスに Mutex 機能を持たせることができます。 また、普通のオブジェクトを Object#extend により Mutex にする事ができます。
...ド同期機構である Mutex のモジュール版です。クラスに
Module#include することでそのクラスに Mutex 機能を持たせることができます。
また、普通のオブジェクトを Object#extend により Mutex にする事ができます。
このモジュール......ラスに Module#include する例
require "mutex_m"
class Foo
include Mutex_m
...
end
obj = Foo.new
obj.synchronize do
# 危険領域(critical section)
...
end
オブジェクトに Object#extend する例
require "mutex_m"
obj = Object.new
obj.extend(Mutex_m)......機構である Thread::Mutex のモジュール版です。クラスに
Module#include することでそのクラスに Mutex 機能を持たせることができます。
また、普通のオブジェクトを Object#extend により Mutex にする事ができます。
このモジュールに... -
SingleForwardable (19.0)
-
オブジェクトに対し、メソッドの委譲機能を定義するモジュールです。
...ッドの委譲機能を定義するモジュールです。
=== 使い方
オブジェクトに対して extend して使います。
例:
require 'forwardable'
g = Goo.new
g.extend SingleForwardable
g.def_delegator("@out", :puts)
g.puts ...
また、SingleForwardable はクラスや......する事もできます。
require 'forwardable'
class Implementation
def self.service
puts "serviced!"
end
end
module Facade
extend SingleForwardable
def_delegator :Implementation, :service
end
Facade.service # => serviced!
もし Forwardable と SingleForwa... -
IRB
:: HistorySavingAbility (17.0) -
IRB::HistorySavingAbility を extend したオブジェクトに irb のヒス トリの読み込み、保存の機能を提供するモジュールです。
...IRB::HistorySavingAbility を extend したオブジェクトに irb のヒス
トリの読み込み、保存の機能を提供するモジュールです。... -
OpenURI
:: Meta (17.0) -
サーバから取得したデータの属性を扱うために使われるモジュールです。 データを表す文字列や StringIO が extend します。
...サーバから取得したデータの属性を扱うために使われるモジュールです。
データを表す文字列や StringIO が extend します。... -
OptionParser
:: Arguable (17.0) -
主に Object::ARGV を拡張するために用意されたモジュールです。 optparse を require することにより、ARGV は OptionParser::Arguable を Object#extend します。
...bject::ARGV を拡張するために用意されたモジュールです。
optparse を require することにより、ARGV は
OptionParser::Arguable を Object#extend します。
コマンドライン引数を表す文字列の配列を、拡張するためにも使うことができます。...