25件ヒット
[1-25件を表示]
(0.039秒)
検索結果
-
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 が定義されていれば
オブジェクトの初期化のためにこれを呼び出します。このこ...