るりまサーチ

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

別のキーワード

  1. string []=
  2. string slice
  3. string slice!
  4. string []
  5. string gsub!

ライブラリ

クラス

検索結果

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

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

...ポートします。

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

メソッドをコピーするため、Rubyコードで定義されたメソッドだけしか
...
...[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 which is not defined with Ruby...

NEWS for Ruby 3.1.0 (3351.0)

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

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

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...* MatchData#match_length が追加されました。 18172

* Method / UnboundMethod
* 新規メソッド
* Method#public?, Method#private?, Method#protected?, UnboundMethod#public?, UnboundMethod#private?, UnboundMethod#protected? が追加されました。 11689

* Module
*...
...には、ハッシュリテラルを使用する必要があります。 16806

* String
* Unicodeと絵文字のバージョンが13.0.0に更新されました。 17750 18029
* String#unpack と String#unpack1 が任意のバイト数をスキップした後にアンパックを開始す...