るりまサーチ

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. matrix i
  5. csv to_i

ライブラリ

キーワード

検索結果

SingleForwardable (6007.0)

オブジェクトに対し、メソッドの委譲機能を定義するモジュールです。

...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 と SingleForwardable の両方を使いたい場合、
def_instance_delegator と def_single_delegator メソッ...

CMath (19.0)

複素数演算をサポートするモジュールです。

...、「メソッド名!」の形式で呼び出します。

//emlist[例][ruby]{
require "cmath"

# 複素数の範囲の立方根(の主値)= exp(1/3 πi)
CMath.cbrt(-1) # => (0.5000000000000001+0.8660254037844386i)

# 実数の範囲の立方根
Math.cbrt(-1) # => -1.0

i
nclude CMath

# レシ...
...ーバー無しで使える
cbrt(-1) # => (0.5000000000000001+0.8660254037844386i)

# cbrt! は Math.cbrt のエイリアス
cbrt!(-1) # => -1.0
//}...