るりまサーチ

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

別のキーワード

  1. module attr
  2. module new
  3. module constants
  4. module module_eval
  5. module class_eval

検索結果

Module#using(module) -> self (39220.0)

引数で指定したモジュールで定義された拡張を現在のクラス、モジュールで有 効にします。

...ルで有
効にします。

有効にした拡張の有効範囲については以下を参照してください。

* https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html#label-Scope

@param module 有効にするモジュールを指定します。

@see Module#refine, main.using...

Module.used_modules -> [Module] (27247.0)

現在のスコープで using されているすべてのモジュールを配列で返します。 配列内のモジュールの順番は未定義です。

...スコープで using されているすべてのモジュールを配列で返します。
配列内のモジュールの順番は未定義です。

//emlist[例][ruby]{
module
A
refine Object do
end
end

module
B
refine Object do
end
end

using
A
using
B
p Module.used_modules
#=> [B, A]
/...

Module#refine(klass) { ... } -> Module (21153.0)

引数 klass で指定したクラスまたはモジュールだけに対して、ブロックで指定した機能を提供で きるモジュールを定義します。定義した機能は Module#refine を使用せずに直 接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。 そのため、既存の機能を局所的に修正したい場合などに用いる事ができます。

...したクラスだけに対して、ブロックで指定した機能を提供で
きるモジュールを定義します。定義した機能は Module#refine を使用せずに直
接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。
そのた...
...ticles/0041/0041-200Special-refinement.html
* https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html

定義した機能は main.using, Module#using を実行した場合のみ
有効になります。

@param klass 拡張する対象のクラスを指定します。

@return ブロッ...
...機能を持つ無名のモジュールを返します。


//emlist[例][ruby]{
class C
def foo
puts "C#foo"
end
end

module
M
refine C do
def foo
puts "C#foo in M"
end
end
end

x = C.new
x.foo # => "C#foo"

using
M

x = C.new
x.foo # => "C#foo in M"
//}

@see main.using...
...モジュールだけに対して、ブロックで指定した機能を提供で
きるモジュールを定義します。定義した機能は Module#refine を使用せずに直
接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。
そのた...
...ticles/0041/0041-200Special-refinement.html
* https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html

定義した機能は main.using, Module#using を実行した場合のみ
有効になります。

@param klass 拡張する対象のクラスまたはモジュールを指定します...

main.using(module) -> self (18238.0)

引数で指定したモジュールで定義された拡張を有効にします。

...ents_rdoc.html#label-Scope

@param module 有効にするモジュールを指定します。

//emlist[例][ruby]{
module
Sloth
refine String do
def downcase
self
end
end
end

"ABC".downcase # => "abc"

using
Sloth

"ABC".downcase # => "ABC"
//}

@see Module#refine, Module#using...

1.6.8から1.8.0への変更点(まとめ) (420.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...いう振
るまい(C の do ... while 構文と同じ)をしていませんでした。
((<ruby-list:34618>))

: ((<"rescue/ensure on class/module"|クラス/メソッドの定義/クラス定義>)) [compat]

メソッド定義のほかにもクラス定義やモジュール定義にもresc...
...クラスと発生した例外オブジェクトの比較 [ruby] [change]

発生した例外 $! と rescue 節の例外クラスとは ((<Module#===|Module/===>))
を使って比較するようになりました。

以前は kind_of? による比較なので基本的な動作に変わりは...
...(<strscan>)),
((<fileutils>)), racc/*

: ((<benchmark>)) [new]
added

: Curses [lib] [compat]

Updated. New methods and constants for using the mouse, character
attributes, colors and key codes have been added.

: Complex#to_i [lib] [obsolete]
: Complex#to_f [lib] [...

絞り込み条件を変える

Refinement#import_methods(*modules) -> self (130.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
#...

NEWS for Ruby 3.0.0 (126.0)

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

...is now a SyntaxError instead of a LocalJumpError. 15575
* When a class variable is overtaken by the same definition in an
ancestor class/module, a RuntimeError is now raised (previously,
it only issued a warning in verbose mode). Additionally, accessing a
class variable from the t...
...* Module
* Module#include and Module#prepend now affect classes and modules that have already included or prepended the receiver, mirroring the behavior if the arguments were included in the receiver before the other modules and classes included or prepended the receiver. 9573
* Module#pu...
...C; end
module
M1; end
module
M2; end
C.include M1
M1.include M2
p C.ancestors #=> [C, M1, M2, Object, Kernel, BasicObject]
//}

* Mutex
* `Mutex` is now acquired per-`Fiber` instead of per-`Thread`. This change should be compatible for essentially all usages and avoids blocking when using a sc...

NEWS for Ruby 2.1.0 (102.0)

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

...l
* 追加: Kernel#singleton_method(Object#singleton_method)

* Module
* 追加: Module#using, which activates refinements of the specified module only
in the current class or module definition.
* 追加: Module#singleton_class? レシーバーが特異クラスであれば true...
...バーが通常のクラスやモジュールであれば false を返します。
* 拡張: Module#refine はもはや実験的な機能でなくなりました
* 拡張: Module#include と Module#prepend はパブリックメソッドになりました

* Mutex
* Mutex#owned? はも...
...long long 型を表します

* toplevel
* main.using はもはや実験的な機能ではありません。
The method activates refinements in the ancestors of the argument module to
support refinement inheritance by Module#include

=== 組み込みクラスの互換性 (機能...

Ruby用語集 (96.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...:rdoc

: refinement
既存のクラスやモジュールを特定のスコープでのみ改変する仕組み。

参照:Module#refine、Module#using、main.using

: Ruby Central
Rubyのサポートと世界の Ruby コミュニティーの支援を専門とする非営利組織。
Ruby...
...ェクトの振る舞いを規定するもの。
Ruby ではクラスも Class クラスのオブジェクトである。

Class クラスは Module クラスの下位クラスであり、モジュールとしての性質も
おおむね受け継いでいる。ただし、一部のメソッド...
...ールの機能を組み込むこと。

参照:Module#include

: 未定義化(メソッドの)
メソッドの定義を取り消すこと。d:spec/def#undef 式もしくは
Module
#undef_method メソッドによって行う。

Module
#remove_method メソッドによるメソッドの...

NEWS for Ruby 2.0.0 (66.0)

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

...* Module
* 追加: Module#prepend 指定したモジュールを self の継承チェインの先頭に
「追加する」ことで self の定数、メソッド、モジュール変数を「上書き」します。
* 追加: Module.prepended, Module.prepend_features は Module.inc...
...luded と Module.append_features に似ています
* 追加(実験的): Module#refine, スコープを限定してクラスやモジュールを拡張します。
* 拡張: Module#define_method は UnboundMethod を受け付けるようになりました
* 拡張: Module#const_get 修...
...nd efficient implementation.

* toplevel
* added method:
* added main.define_method which defines a global function.
* added main.using, which imports refinements into the current file or
eval string. [experimental]

=== 組み込みクラスの互換性 (機能追加とバ...

絞り込み条件を変える

NEWS for Ruby 2.7.0 (60.0)

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

...告が表示されるようになりました。

//emlist[][ruby]{
def foo
proc
end
foo { puts "Hello" } #=> warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
//}

* 非推奨に関する警告を止めたい場合は、コマンドライン引数に...
...告は Ruby 3.0 では verbose モードでなくても表示され、Ruby 3.2 で削除される
予定です。 16131

* Object#methodとModule#instance_methodがrefinementsを考慮するようになりました。 15373

=== コマンドラインオプション

==== 警告オプション...
...145

* Module
* 新規メソッド
* 定数が定義された場所を取得するModule#const_source_location
メソッドが追加されました。 10771
* 通常の引数分解でキーワード引数を渡すようにメソッドに印をつける
Module
#ruby2_...