14件ヒット
[1-14件を表示]
(0.015秒)
別のキーワード
検索結果
-
Range (38102.0)
-
範囲オブジェクトのクラス。 範囲オブジェクトは文字どおり何らかの意味での範囲を表します。数の範囲はもちろん、 日付の範囲や、「"a" から "z" まで」といった文字列の範囲を表すこともできます。
...囲オブジェクトは、Range.new を用いるほか、範囲演算子(`..' または `...')を
用いた d:spec/operator#range で生成できます。
いずれの方法でも始端と終端を与えます。
//emlist[範囲オブジェクトの例][ruby]{
Range.new(1, 5) # 1 以上 5 以......囲オブジェクト」
を作ることができるようになりました。
//emlist[終端を持たない範囲オブジェクト][ruby]{
p Range.new(1, nil) # 1 以上(上限無し)を表す
p(1..nil) # 同上
p(1..) # 同上(略した書き方)
//}
また、Ru......以下はすべて同じ範囲
p Range.new(nil, nil) # => nil..nil
p(nil..nil) # => nil..nil
p(..nil) # => nil..nil
p(nil..) # => nil..nil
//}
範囲式で両端を略した書き方はできません。
p(..) # => SyntaxError
p(...) # Ruby 2.7 で導入... -
NEWS for Ruby 2
. 7 . 0 (96.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...bar
lambda
end
bar { puts "Hello" } #=> tried to create Proc object without a block (ArgumentError)
//}
==== その他の変更
* 始端なしRangeが実験的に導入されました。
caseやComparable#clampや定数やDSLなどで便利かもしれません。
14799
//emlist[][rub......の識別子の引用符は同じ行で閉じる必要があります。
//emlist{
<<"EOS
" # This had been warned since 2.4; Now it raises a SyntaxError
EOS
//}
* フリップフロップが非推奨になったのが元に戻されました。 5400
* 以下のような場所にコメント......ワード引数やブロックを含む)を bar に転送します。
注意点として括弧は必須です。「bar ...」は終端なし Range と解釈されます。
//emlist[][ruby]{
def foo(...)
bar(...)
end
//}
* 「$SAFE」の参照や代入は警告が表示されるように... -
NEWS for Ruby 3
. 0 . 0 (24.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...have been removed.
16131 17136
* yield in singleton class definitions in methods is now a SyntaxError
instead of a warning. yield in a class definition outside of a method
is now a SyntaxError instead of a LocalJumpError. 15575
* When a class variable is overtaken by the same defini......tionally, accessing a
class variable from the toplevel scope is now a RuntimeError.
14541
* Assigning to a numbered parameter is now a SyntaxError instead of
a warning.
== Command line options
=== `--help` option
When the environment variable `RUBY_PAGER` or `PAGER` is present and h......to StringScanner 3.0.0
* This version is Ractor compatible.
== Compatibility issues
Excluding feature bug fixes.
* Regexp literals and all Range objects are frozen. 8948 16377 15504
//emlist[][ruby]{
/foo/.frozen? #=> true
(42...).frozen? # => true
//}
* EXPERIMENTAL: Hash#each consiste...