るりまサーチ

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

別のキーワード

  1. rake import
  2. fiddle/import malloc
  3. fiddle/import to_i
  4. fiddle/import new
  5. fiddle/import union

ライブラリ

クラス

検索結果

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

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

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

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

メソッドをコピーするため、Rubyコードで...
...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
//}...

NEWS for Ruby 3.1.0 (12.0)

NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...inement
* Module#refineで作成されたモジュールを表す新しいクラス。includeとprependは非推奨になり、代わりにimport_methodsが追加されました。

== 標準添付ライブラリの更新(機能追加とバグ修正を除く)

* 以下のdefault gemsが更新...
...メータに制約を与えることができるようになりました。 https://github.com/ruby/rbs/pull/844

//emlist{
# `T` must be compatible with the `_Output` interface.
# `PrettyPrint[String]` is ok, but `PrettyPrint[Integer]` is a type error.
class PrettyPrint[T < _Output]
interface _Ou...