るりまサーチ

最速Rubyリファレンスマニュアル検索!
31件ヒット [1-31件を表示] (0.019秒)

別のキーワード

  1. enumerator each
  2. each enumerator
  3. enumerator with_index
  4. enumerator with_object
  5. enumerator new

検索結果

optparse (38186.0)

コマンドラインのオプションを取り扱うためのライブラリです。

...コマンドラインのオプションを取り扱うためのライブラリです。

=== チュートリアル

optparse
を使う場合、基本的には

(1) OptionParser オブジェクト opt を生成する。
(2) オプションを取り扱うブロックを opt に登録する。
(3) o...
...ョンの定義

以下はオプション -a, -b を受け付けるコマンドを作成する例です。

//emlist[sample.rb][ruby]{
require 'optparse'
opt = OptionParser.new

opt.on('-a') {|v| p v }
opt.on('-b') {|v| p v }

opt.parse!(ARGV)
p ARGV
//}

ruby sample.rb -a foo bar -b baz...
...述します。ブロックの引数にはオプションが指定
されたことを示す true が渡されます(optionargの項も参照)。

Enumerator
#each などと違い、OptionParser#on
メソッドが呼ばれた時点ではブロックは実行されません。あくまで登録され...

NEWS for Ruby 2.7.0 (90.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...>1}
//}

* Enumerator
* 新規メソッド
* 任意のデータ変換からEnumeratorを作成するための
Enumerator
.produceメソッドが追加されました。 14781
* lazy enumerator から lazy ではない enumerator を生成する
Enumerator
::Lazy#eager...
...ドが追加されました。 15901
* Enumerator::Yielder#to_procメソッドが追加され、Yielder オブジェクトを
直接他のメソッドのブロック引数として渡せるようになりました。 15618
* Enumerator::Lazy#with_indexメソッドが追加され...
...* 不明なオプションに対して "Did you mean?" が表示されるようになりました。 16256

//emlist[test.rb][ruby]{
require "optparse"
OptionParser.new do |opts|
opts.on("-f", "--foo", "foo") {|v| }
opts.on("-b", "--bar", "bar") {|v| }
opts.on("-c", "--baz", "baz") {|v| }...

NEWS for Ruby 2.4.0 (30.0)

NEWS for Ruby 2.4.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...クを省略した場合 Enumerator を返すようになりました。2172
* Enumerable#sum を追加 12217
* Enumerable#uniq を追加 11090

* Enumerator::Lazy
* Enumerator::Lazy#chunk_while を追加 https://github.com/ruby/ruby/pull/1186
* Enumerator::Lazy#uniq を追加 1109...
.../OpenSSL 2.0
OpenSSL は https://github.com/ruby/openssl に分離されましたが、デフォルトGemとして残っています。

* optparse
* OptionParser#parseやOptionParser#orderにキーワード引数 into を追加 11191

* pathname
* Pathname#empty? を追加 12596...

NEWS for Ruby 3.1.0 (18.0)

NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...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
* 変更されたメソッド
* File.dirname が...
...1
* json 2.6.1
* logger 1.5.0
* net-http 0.2.0
* net-protocol 0.1.2
* nkf 0.1.1
* open-uri 0.2.0
* openssl 3.0.0
* optparse 0.2.0
* ostruct 0.5.2
* pathname 0.2.0
* pp 0.3.0
* prettyprint 0.1.1
* psych 4.0.3
* racc 1.6.0
* rdoc 6.4.0
*...

NEWS for Ruby 3.0.0 (12.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ray#slice!
* Array#slice / Array#[]
* Array#take
* Array#take_while
* Array#uniq
* Array#*
* Can be sliced with Enumerator::ArithmeticSequence

//emlist[][ruby]{
dirty_data = ['--', 'data1', '--', 'data2', '--', 'data3']
dirty_data[(1..).step(2)] # take each second...
...* drb
* debug
* erb
* find
* net-ftp
* net-http
* net-imap
* net-protocol
* open-uri
* optparse
* pp
* prettyprint
* resolv-replace
* resolv
* rinda
* set
* securerandom
* shellwords
* t...

絞り込み条件を変える