るりまサーチ

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

別のキーワード

  1. win32ole ole_methods
  2. fileutils methods
  3. win32ole ole_put_methods
  4. win32ole ole_get_methods
  5. win32ole ole_func_methods

ライブラリ

クラス

検索結果

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

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

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

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

メソッドをコピーするため、Rubyコードで...
...てください。

//emlist[][ruby]{
module
StrUtils
def 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...