るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

種類

ライブラリ

クラス

検索結果

Object::DATA -> File (18209.0)

スクリプトの __END__ プログラムの終り以降をアクセスする File オブジェクト。

...んでおくことができます。
DATA
定数はそのデータ部分にアクセスするための File オブジェクトを保持しています。

__END__ を含まないプログラムにおいては DATA は定義されません。

=== 注意

* DATA.rewind で移動する読みとり...
...ファイル ($0) を指します。

=== 例1
print DATA.gets # => 故人西辞黄鶴楼
print DATA.gets # => 烟花三月下揚州
print DATA.gets # => 孤帆遠影碧空尽
print DATA.gets # => 唯見長江天際流
DATA
.gets # => nil

__END__
故人西辞黄...
...江天際流

=== 例2
sum = 0
DATA
.each_line do |line|
sum += line.to_i
end

DATA
.rewind
p DATA.gets # => "sum = 0¥n"

__END__
17
19
23
29
31

=== 例3
DATA
.gets # => uninitialized constant DATA (NameError)

=== 例4

ファイル...

NEWS for Ruby 3.0.0 (54.0)

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

...*
* Can be sliced with Enumerator::ArithmeticSequence

//emlist[][ruby]{
dirty_data = ['--', 'data1', '--', 'data2', '--', 'data3']
dirty_data[(1..).step(2)] # take each second element
# => ["data1", "data2", "data3"]
//}

* Binding
* Binding#eval when called with one argument will use `"(...
...* String#delete_suffix
* String#downcase
* String#dump
* String#each_char
* String#each_grapheme_cluster
* String#each_line
* String#gsub
* String#ljust
* String#lstrip
* String#partition
* String#reverse
* String#rjust
* Stri...
...r a bitmap image, between extension libraries. The extension libraries can share also the metadata of the memory area that consists of the shape, the element format, and so on. Using these kinds of metadata, the extension libraries can share even a multidimensional array appropriately. This feature...

NEWS for Ruby 2.0.0 (36.0)

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

...を導入しました。期待しないスタックオーバーフローを避けるためです

* GC::Profiler
* 追加: GC::Profiler.raw_data GCの加工していないプロファイルデータを返します

* Hash
* 追加: Hash#to_h 明示的に変換するメソッドです。A...
...str.lines.with_index(1) {|line, lineno| ... } # str.lines が配列を返すのでもう動かない
str.each_line.with_index(1) {|line, lineno| ... } # このように each_line に置き換える
//}

* IO#lines, IO#chars, IO#codepoints, IO#bytes, ARGF#lines, ARGF#chars,
ARGF#bytes,...
...gIO#codepoints, StringIO#bytes,
Zlib::GzipReader#lines, Zlib::GzipReader#bytes
* これらのメソッドは非推奨になりました。each_line, each_byte, each_char, each_codepoint を使ってください。

* Proc#==, m:Proc#eql?
* 削除されました。2つの Proc オブジ...

NEWS for Ruby 2.4.0 (24.0)

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

...IO#each_line, IO#readlines, IO.foreach は
chomp というキーワード引数を受け付けるようになりました。12553

* Kernel
* Kernel#clone は freeze というキーワード引数を受け付けるようになりました。
12300

* MatchData
* MatchData#na...
...med_captures を追加 11999
* MatchData#values_at は named captures をサポートするようになりました 9179

* Module
* Module#refine 引数としてモジュールを許可するようになりました 12534
* Module.used_modules を追加 7418

* Numeric
* Numeric...
...String#casecmp? を追加 12786
* String#concat, String#prepend 複数の引数を受け付けるようになりました 12333
* String#each_line, String#lines 省略可能なキーワード引数 chomp を受け付けるようになりました 12553
* String#match? を追加 12898...

制御構造 (18.0)

制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END

...左辺の式が begin 節である場合にはそれを最初に一回評価してから繰り返します。

//emlist[例][ruby]{
send_request(data)
begin
res = get_response()
end while res == 'Continue'
//}

while 修飾した式は nil を返します。
また、引数を伴った break に...
...左辺の式が begin 節である場合にはそれを最初に一回評価してから繰り返します。

//emlist[例][ruby]{
send_request(data)
begin
res = get_response()
end until res == 'OK'
//}

until 修飾した式は nil を返します。
また、引数を伴った break により...
...定した場合はループの戻り値はその引数になります。


====[a:next] next

//emlist[例][ruby]{
# 空行を捨てるcat
ARGF.each_line do |line|
next if line.strip.empty?
print line
end
//}

文法:

next

next val


nextはもっとも内側のループの...

絞り込み条件を変える