るりまサーチ

最速Rubyリファレンスマニュアル検索!
1126件ヒット [1101-1126件を表示] (0.035秒)

別のキーワード

  1. module attr
  2. module public
  3. module private
  4. module protected

ライブラリ

クラス

モジュール

検索結果

<< < ... 10 11 12 >>

SingleForwardable (12.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 と Si...

WIN32OLE_TYPE#ole_type -> String | nil (12.0)

selfの型の種類(TYPEKIND)を取得します。

...

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'Application')
p tobj.ole_type # => Class

ole_typeには以下があります。

: Enum
列挙子(0)
: Record
ユーザ定義型(メソッドを持たない構造体)(1)
: Module
モジュール(静的関...

制御構造 (12.0)

制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END

...# 例外 RuntimeError を発生させる
# 以下の二つは SyntaxError を発生させる
raise SyntaxError, "invalid syntax"
raise SyntaxError.new("invalid syntax")
raise # 最後の例外の再発生
//}

文法:

raise
raise messageまたはexception...
...文が存在しなかったときの値
はnilです。いずれにしてもensure節の値は無視されます。

d:spec/def#class、d:spec/def#module、d:spec/def#method
などの定義文では、それぞれ
begin なしで rescue, ensure 節を定義でき、これにより例外を処理す...
<< < ... 10 11 12 >>