るりまサーチ

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

別のキーワード

  1. _builtin main
  2. main define_method
  3. main public
  4. main private

ライブラリ

クラス

オブジェクト

検索結果

main.using(module) -> self (39113.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...

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

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

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

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

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

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

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

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

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

.../articles/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...
.../articles/0041/0041-200Special-refinement.html
* https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html

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

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

Ruby用語集 (30.0)

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

...省メモリー性など、機器組み込みや
アプリケーションソフト組込みに適した特徴を持つ。

https://mruby.org/

: main
トップレベルにおける self。Object クラスのインスタンスである。

===[a:N] N

: nil
NilClass の唯一のインスタ...
...efinement
既存のクラスやモジュールを特定のスコープでのみ改変する仕組み。

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

: Ruby Central
Rubyのサポートと世界の Ruby コミュニティーの支援を専門とする非営利組織。
RubyConf(Inter...
...キスト。つまり、すべてのモジュール定義、
クラス定義、メソッド定義の外側である。

トップレベルでは main が self となる。

===[a:na] な

: 名前空間
: namespace
メソッドや定数の名前の衝突を避ける仕組み。
クラスや...

NEWS for Ruby 2.0.0 (24.0)

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

...set_trace_func.
Easy to use and 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]

=== 組み込みク...
...ult. See Net::HTTP for details.
* SSL sessions are now reused across connections for a single instance.
This speeds up connection by using a previously negotiated session.
* Requests may be created from a URI which sets the request_uri and host
header of the request (but...

絞り込み条件を変える

NEWS for Ruby 2.1.0 (18.0)

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

...受け付けるようになりました

* Kernel
* 追加: 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?...
...pack/unpack (Array/String)
* プラットフォームが対応していれば Q! と q! は long long 型を表します

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

NEWS for Ruby 2.7.0 (12.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
//}

* 非推奨に関する警告を止めたい場合は、コマンドライン引数に...
...ar") {|v| }
opts.on("-c", "--baz", "baz") {|v| }
end.parse!
//}

//emlist{
$ ruby test.rb --baa
Traceback (most recent call last):
test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption)
Did you mean? baz
bar
//}

* Pathname
* Pathname.globがbaseキーワ...

Proc.new -> Proc (12.0)

ブロックをコンテキストとともにオブジェクト化して返します。

...ブロックを指定しない場合、Ruby 2.7 では
$VERBOSE = true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
...
...Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc.new は、Proc#initialize が定義されていれば
オブジェクトの初期化のためにこれを呼び出します。このこ...

Proc.new { ... } -> Proc (12.0)

ブロックをコンテキストとともにオブジェクト化して返します。

...ブロックを指定しない場合、Ruby 2.7 では
$VERBOSE = true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
...
...Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc.new は、Proc#initialize が定義されていれば
オブジェクトの初期化のためにこれを呼び出します。このこ...