49件ヒット
[1-49件を表示]
(0.032秒)
種類
- 文書 (27)
- インスタンスメソッド (11)
- ライブラリ (11)
ライブラリ
- ビルトイン (11)
モジュール
- Enumerable (11)
キーワード
-
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 4 . 0 (8) -
net
/ pop (11)
検索結果
先頭5件
-
Enumerable
# chunk {|elt| . . . } -> Enumerator (18149.0) -
要素を前から順にブロックで評価し、その結果によって 要素をチャンクに分けた(グループ化した)要素を持つ Enumerator を返します。
...クの要素を持つ配列のペアを各要素とします。
そのため、eachだと以下のようになります。
//emlist[][ruby]{
enum.chunk {|elt| key }.each {|key, ary| do_something }
//}
例として、整数列を連続する奇数/偶数に分ける例を見てみます。
「n.eve......?」の値が切り替わるところで区切られているのがわかるでしょう。
//emlist[例][ruby]{
[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5].chunk {|n|
n.even?
}.each {|even, ary|
p [even, ary]
}
# => [false, [3, 1]]
# [true, [4]]
# [false, [1, 5, 9]]
# [true, [2, 6]]
# [false......"\n"]
# ...
//}
テキストを空行で区切られた段落に分けたい場合にも nil が使えます。
//emlist[例][ruby]{
File.foreach("README").chunk {|line|
/\A\s*\z/ !~ line || nil
}.each {|_, lines|
pp lines
}
//}
「:_alone」は要素を素通ししたい場合に用いま... -
NEWS for Ruby 2
. 3 . 0 (72.0) -
NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...grep_v を追加
11049
* Enumerable#chunk_while
10769
* Enumerator::Lazy
* Enumerator::Lazy#grep_v を追加
11773
* File
* File.mkfifo
11536
* O_TMPFILE に対応する File::TMPFILE(File::Constants::TMPFILE) を追加
* Hash
* Hash#fetch_values......643
* Hash#<=, Hash#<, Hash#>=, Hash#> を追加
10984
* Hash#to_proc を追加
11653
* IO
* 新しいフラグ File::SHARE_DELETE(File::Constants::SHARE_DELETE) が使用できます。
Windows で開いているファイルを削除することを許可しますが......1
* Enumerable
* Enumerable#chunk と Enumerable#slice_before は初期状態を引数として受け取らなくなりました。
状態の管理にはローカル変数を使ってください。
10958
* File::Stat
* Windows では File::Stat#ino は常に 0 を返して... -
net
/ pop (54.0) -
このライブラリは、POP3 (Post Office Protocol version 3) を 用いてPOPサーバからメールを受信する機能を提供するライブラリです。
...始
if pop.mails.empty?
$stderr.puts 'no mail.'
else
pop.mails.each_with_index do |m, idx| # 各メッセージにアクセスする
File.open("inbox/#{idx + 1}", 'w') {|f|
f.write m.pop
}
m.delete
end
$stderr.puts "#{pop.mails.size} mails popped."
en......'YourAccount', 'YourPassword') {|pop|
if pop.mails.empty?
$stderr.puts 'no mail.'
else
pop.mails.each_with_index do |m, idx|
File.open("inbox/#{idx + 1}", 'w') {|f|
f.write m.pop
}
m.delete
end
$stderr.puts "#{pop.mails.size} mails po......0
Net::POP3.delete_all('pop.example.com', 110,
'YourAccount', 'YourPassword') do |m|
File.open('inbox/#{i}', 'w') {|f|
m.pop {|chunk|
f.write(chunk)
}
}
i += 1
end
==== APOP を使う
Net::POP3 クラスのかわりに Net::APOP クラス... -
NEWS for Ruby 2
. 2 . 0 (42.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...93
=== 組み込みクラスの更新
* Binding
* 追加: Binding#local_variables
* 追加: Binding#receiver
* Dir
* 追加: Dir#fileno
* Enumerable
* 追加: Enumerable#slice_after
* 追加: Enumerable#slice_when
* 拡張: Enumerable#min, Enumerable#min_by, Enumera......ポートしました
* Float
* 追加: Float#next_float
* 追加: Float#prev_float
* File
* 追加: File.birthtime
* 追加: File#birthtime
* File::Stat
* 追加: File::Stat#birthtime
* GC
* GC.latest_gc_info は現在のGCのステータスを再現するため......(機能追加とバグ修正を除く)
* Enumerable
* Enumerable#slice_before の状態管理は非推奨になりました
* Enumerable#chunk の状態管理は非推奨になりました
* GC
* 非互換: GC.stat のエントリーの名前を変更しました 9924
https:/... -
NEWS for Ruby 2
. 4 . 0 (24.0) -
NEWS for Ruby 2.4.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...10121
* Enumerable
* Enumerable#chunk ブロックを省略した場合 Enumerator を返すようになりました。2172
* Enumerable#sum を追加 12217
* Enumerable#uniq を追加 11090
* Enumerator::Lazy
* Enumerator::Lazy#chunk_while を追加 https://github.com/ruby/ru......by/pull/1186
* Enumerator::Lazy#uniq を追加 11090
* File
* File.empty? を追加 9969
* Float
* Float#ceil, Float#floor, Float#truncate は
Float#roundと同じように省略可能な桁を指定する引数を受け付けるようになりました。12245
* Float#ro...