るりまサーチ

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.054秒)
トップページ > クエリ:d[x] > クエリ:Method[x] > クラス:Refinement[x]

別のキーワード

  1. bigdecimal/util to_d
  2. float to_d
  3. matrix d
  4. rsa d
  5. openssl d

ライブラリ

検索結果

Refinement#import_methods(*modules) -> self (12207.0)

モジュールからメソッドをインポートします。

...モジュールからメソッドをインポートします。

Module#includeと違って、import_methods はメソッドをコピーして
refinement
に追加して、refinementでインポートしたメソッドを有効化します。

メソッドをコピーするため、Rubyコードで...
...module StrUtils
d
ef indent(level)
' ' * level + self
end
end

module M
refine String do
import_methods StrUtils
end
end

using M
p "foo".indent(3) # => " foo"

module M
refine String do
import_methods Enumerable
# Can't import method which is not defined with Ruby code:...
...Enumerable#drop
end
end
//}...