るりまサーチ

最速Rubyリファレンスマニュアル検索!
25件ヒット [1-25件を表示] (0.039秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:main[x] > クエリ:using[x] > 種類:特異メソッド[x]

別のキーワード

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

クラス

オブジェクト

検索結果

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

Proc.new -> Proc (15.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 (15.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 が定義されていれば
オブジェクトの初期化のためにこれを呼び出します。このこ...