26件ヒット
[1-26件を表示]
(0.050秒)
種類
- 文書 (12)
- 特異メソッド (11)
- インスタンスメソッド (3)
ライブラリ
- ビルトイン (14)
クラス
-
Enumerator
:: Lazy (11)
モジュール
- Enumerable (3)
キーワード
-
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - new (11)
検索結果
先頭5件
-
Enumerable
# compact -> Array (18141.0) -
self から nil を取り除いた配列を生成して返します。
...self から nil を取り除いた配列を生成して返します。
//emlist[][ruby]{
def with_nils
yield 1
yield 2
yield nil
yield 3
end
to_enum(:with_nils).compact # => [1, 2, 3]
//}
@see Array#compact... -
NEWS for Ruby 2
. 7 . 0 (312.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...p b #=> 1
p c #=> [2, 3]
end
//}
//emlist[][ruby]{
case {a: 0, b: 1}
in {a: 0, x: 1}
:unreachable
in {a: 0, b: var}
p var #=> 1
end
//}
//emlist[][ruby]{
case -1
in 0 then :unreachable
in 1 then :unreachable
end #=> NoMatchingPatternError
//}
//emlist{
json = <<END
{
"name": "Alice",
"a......ましたが、
再び許容されるようになりました。 15658
//emlist[][ruby]{
def foo(**kw); p kw; end; foo("str" => 1) #=> {"str"=>1}
//}
* メソッド定義で**nilと書くことで、このメソッドがキーワードを
受け取らないことを明示できるよう......ンを受け付けるように
なりました。 15751
* GC
* 新規メソッド
* ヒープをコンパクションするGC.compactメソッドが追加されました。
このメソッドはヒープの生きているオブジェクトをコンパクションして... -
Enumerator
:: Lazy . new(obj , size=nil) {|yielder , *values| . . . } -> Enumerator :: Lazy (137.0) -
Lazy Enumerator を作成します。Enumerator::Lazy#force メソッドなどに よって列挙が実行されたとき、objのeachメソッドが実行され、値が一つずつ ブロックに渡されます。ブロックは、yielder を使って最終的に yield される値を 指定できます。
...module Enumerable
def filter_map(&block)
map(&block).compact
end
end
class Enumerator::Lazy
def filter_map
Lazy.new(self) do |yielder, *values|
result = yield *values
yielder << result if result
end
end
end
1.step.lazy.filter_map{|i| i*i if i.even?}.first(5)
#... -
NEWS for Ruby 3
. 1 . 0 (108.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ッドに渡されるだけの場合は、ブロックの引数を無名にできるようになりました。 11256
//emlist{
def foo(&)
bar(&)
end
//}
* ピン演算子に式を書けるようになりました。 17411
//emlist{
Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3......す。
//emlist[Class#subclasses][ruby]{
class A; end
class B < A; end
class C < B; end
class D < A; end
A.subclasses #=> [D, B]
B.subclasses #=> [C]
C.subclasses #=> []
//}
* Enumerable
* 新規メソッド
* Enumerable#compactが追加されました。 17312
* Enumera......ons Enumerable#each_slice][ruby]{
[1, 2, 3].each_cons(2){}
# 3.0 => nil
# 3.1 => [1, 2, 3]
[1, 2, 3].each_slice(2){}
# 3.0 => nil
# 3.1 => [1, 2, 3]
//}
* Enumerator::Lazy
* 新規メソッド
* Enumerator::Lazy#compact が追加されました。 17312
* File
* 変更された... -
NEWS for Ruby 3
. 0 . 0 (84.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...> a=>1}, {}]
//}
* Arguments forwarding (`...`) now supports leading arguments.
16378
//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}
* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]......Fiber#transfer is relaxed. 17221
* GC
* GC.auto_compact= and GC.auto_compact have been added to control when compaction runs. Setting `auto_compact=` to `true` will cause compaction to occur during major collections. At the moment, compaction adds significant overhead to major collections, s......da's arity check.
* When writing to STDOUT redirected to a closed pipe, no broken pipe error message will be shown now. 14413
* `TRUE`/`FALSE`/`NIL` constants are no longer defined.
* Integer#zero? overrides Numeric#zero? for optimization. 16961
* Enumerable#grep and Enumerable#grep_v when...